UNPKG

218 kBJavaScriptView Raw
1"use strict";
2/*
3 * ---------------------------------------------------------
4 * Copyright(C) Microsoft Corporation. All rights reserved.
5 * ---------------------------------------------------------
6 *
7 * ---------------------------------------------------------
8 * Generated file, DO NOT EDIT
9 * ---------------------------------------------------------
10 */
11var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13 return new (P || (P = Promise))(function (resolve, reject) {
14 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17 step((generator = generator.apply(thisArg, _arguments || [])).next());
18 });
19};
20Object.defineProperty(exports, "__esModule", { value: true });
21exports.TaskAgentApiBase = void 0;
22const basem = require("./ClientApiBases");
23const TaskAgentInterfaces = require("./interfaces/TaskAgentInterfaces");
24class TaskAgentApiBase extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-TaskAgent-api', options);
27 }
28 /**
29 * @param {TaskAgentInterfaces.TaskAgentCloud} agentCloud
30 */
31 addAgentCloud(agentCloud) {
32 return __awaiter(this, void 0, void 0, function* () {
33 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
34 let routeValues = {};
35 try {
36 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues);
37 let url = verData.requestUrl;
38 let options = this.createRequestOptions('application/json', verData.apiVersion);
39 let res;
40 res = yield this.rest.create(url, agentCloud, options);
41 let ret = this.formatResponse(res.result, null, false);
42 resolve(ret);
43 }
44 catch (err) {
45 reject(err);
46 }
47 }));
48 });
49 }
50 /**
51 * @param {number} agentCloudId
52 */
53 deleteAgentCloud(agentCloudId) {
54 return __awaiter(this, void 0, void 0, function* () {
55 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
56 let routeValues = {
57 agentCloudId: agentCloudId
58 };
59 try {
60 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues);
61 let url = verData.requestUrl;
62 let options = this.createRequestOptions('application/json', verData.apiVersion);
63 let res;
64 res = yield this.rest.del(url, options);
65 let ret = this.formatResponse(res.result, null, false);
66 resolve(ret);
67 }
68 catch (err) {
69 reject(err);
70 }
71 }));
72 });
73 }
74 /**
75 * @param {number} agentCloudId
76 */
77 getAgentCloud(agentCloudId) {
78 return __awaiter(this, void 0, void 0, function* () {
79 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
80 let routeValues = {
81 agentCloudId: agentCloudId
82 };
83 try {
84 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues);
85 let url = verData.requestUrl;
86 let options = this.createRequestOptions('application/json', verData.apiVersion);
87 let res;
88 res = yield this.rest.get(url, options);
89 let ret = this.formatResponse(res.result, null, false);
90 resolve(ret);
91 }
92 catch (err) {
93 reject(err);
94 }
95 }));
96 });
97 }
98 /**
99 */
100 getAgentClouds() {
101 return __awaiter(this, void 0, void 0, function* () {
102 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
103 let routeValues = {};
104 try {
105 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues);
106 let url = verData.requestUrl;
107 let options = this.createRequestOptions('application/json', verData.apiVersion);
108 let res;
109 res = yield this.rest.get(url, options);
110 let ret = this.formatResponse(res.result, null, true);
111 resolve(ret);
112 }
113 catch (err) {
114 reject(err);
115 }
116 }));
117 });
118 }
119 /**
120 * @param {TaskAgentInterfaces.TaskAgentCloud} updatedCloud
121 * @param {number} agentCloudId
122 */
123 updateAgentCloud(updatedCloud, agentCloudId) {
124 return __awaiter(this, void 0, void 0, function* () {
125 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
126 let routeValues = {
127 agentCloudId: agentCloudId
128 };
129 try {
130 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues);
131 let url = verData.requestUrl;
132 let options = this.createRequestOptions('application/json', verData.apiVersion);
133 let res;
134 res = yield this.rest.update(url, updatedCloud, options);
135 let ret = this.formatResponse(res.result, null, false);
136 resolve(ret);
137 }
138 catch (err) {
139 reject(err);
140 }
141 }));
142 });
143 }
144 /**
145 * Get agent cloud types.
146 *
147 */
148 getAgentCloudTypes() {
149 return __awaiter(this, void 0, void 0, function* () {
150 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
151 let routeValues = {};
152 try {
153 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "5932e193-f376-469d-9c3e-e5588ce12cb5", routeValues);
154 let url = verData.requestUrl;
155 let options = this.createRequestOptions('application/json', verData.apiVersion);
156 let res;
157 res = yield this.rest.get(url, options);
158 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentCloudType, true);
159 resolve(ret);
160 }
161 catch (err) {
162 reject(err);
163 }
164 }));
165 });
166 }
167 /**
168 * @param {string} project - Project ID or project name
169 * @param {number} queueId
170 * @param {number} top
171 * @param {string} continuationToken
172 */
173 getAgentRequestsForQueue(project, queueId, top, continuationToken) {
174 return __awaiter(this, void 0, void 0, function* () {
175 if (top == null) {
176 throw new TypeError('top can not be null or undefined');
177 }
178 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
179 let routeValues = {
180 project: project,
181 queueId: queueId
182 };
183 let queryValues = {
184 '$top': top,
185 continuationToken: continuationToken,
186 };
187 try {
188 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f5f81ffb-f396-498d-85b1-5ada145e648a", routeValues, queryValues);
189 let url = verData.requestUrl;
190 let options = this.createRequestOptions('application/json', verData.apiVersion);
191 let res;
192 res = yield this.rest.get(url, options);
193 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
194 resolve(ret);
195 }
196 catch (err) {
197 reject(err);
198 }
199 }));
200 });
201 }
202 /**
203 * @param {TaskAgentInterfaces.TaskAgentJobRequest} request
204 * @param {string} project - Project ID or project name
205 * @param {number} queueId
206 */
207 queueAgentRequest(request, project, queueId) {
208 return __awaiter(this, void 0, void 0, function* () {
209 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
210 let routeValues = {
211 project: project,
212 queueId: queueId
213 };
214 try {
215 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f5f81ffb-f396-498d-85b1-5ada145e648a", routeValues);
216 let url = verData.requestUrl;
217 let options = this.createRequestOptions('application/json', verData.apiVersion);
218 let res;
219 res = yield this.rest.create(url, request, options);
220 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false);
221 resolve(ret);
222 }
223 catch (err) {
224 reject(err);
225 }
226 }));
227 });
228 }
229 /**
230 * Adds an agent to a pool. You probably don't want to call this endpoint directly. Instead, [configure an agent](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) using the agent download package.
231 *
232 * @param {TaskAgentInterfaces.TaskAgent} agent - Details about the agent being added
233 * @param {number} poolId - The agent pool in which to add the agent
234 */
235 addAgent(agent, poolId) {
236 return __awaiter(this, void 0, void 0, function* () {
237 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
238 let routeValues = {
239 poolId: poolId
240 };
241 try {
242 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues);
243 let url = verData.requestUrl;
244 let options = this.createRequestOptions('application/json', verData.apiVersion);
245 let res;
246 res = yield this.rest.create(url, agent, options);
247 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false);
248 resolve(ret);
249 }
250 catch (err) {
251 reject(err);
252 }
253 }));
254 });
255 }
256 /**
257 * Delete an agent. You probably don't want to call this endpoint directly. Instead, [use the agent configuration script](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) to remove an agent from your organization.
258 *
259 * @param {number} poolId - The pool ID to remove the agent from
260 * @param {number} agentId - The agent ID to remove
261 */
262 deleteAgent(poolId, agentId) {
263 return __awaiter(this, void 0, void 0, function* () {
264 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
265 let routeValues = {
266 poolId: poolId,
267 agentId: agentId
268 };
269 try {
270 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues);
271 let url = verData.requestUrl;
272 let options = this.createRequestOptions('application/json', verData.apiVersion);
273 let res;
274 res = yield this.rest.del(url, options);
275 let ret = this.formatResponse(res.result, null, false);
276 resolve(ret);
277 }
278 catch (err) {
279 reject(err);
280 }
281 }));
282 });
283 }
284 /**
285 * Get information about an agent.
286 *
287 * @param {number} poolId - The agent pool containing the agent
288 * @param {number} agentId - The agent ID to get information about
289 * @param {boolean} includeCapabilities - Whether to include the agent's capabilities in the response
290 * @param {boolean} includeAssignedRequest - Whether to include details about the agent's current work
291 * @param {boolean} includeLastCompletedRequest - Whether to include details about the agents' most recent completed work
292 * @param {string[]} propertyFilters - Filter which custom properties will be returned
293 */
294 getAgent(poolId, agentId, includeCapabilities, includeAssignedRequest, includeLastCompletedRequest, propertyFilters) {
295 return __awaiter(this, void 0, void 0, function* () {
296 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
297 let routeValues = {
298 poolId: poolId,
299 agentId: agentId
300 };
301 let queryValues = {
302 includeCapabilities: includeCapabilities,
303 includeAssignedRequest: includeAssignedRequest,
304 includeLastCompletedRequest: includeLastCompletedRequest,
305 propertyFilters: propertyFilters && propertyFilters.join(","),
306 };
307 try {
308 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues, queryValues);
309 let url = verData.requestUrl;
310 let options = this.createRequestOptions('application/json', verData.apiVersion);
311 let res;
312 res = yield this.rest.get(url, options);
313 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false);
314 resolve(ret);
315 }
316 catch (err) {
317 reject(err);
318 }
319 }));
320 });
321 }
322 /**
323 * Get a list of agents.
324 *
325 * @param {number} poolId - The agent pool containing the agents
326 * @param {string} agentName - Filter on agent name
327 * @param {boolean} includeCapabilities - Whether to include the agents' capabilities in the response
328 * @param {boolean} includeAssignedRequest - Whether to include details about the agents' current work
329 * @param {boolean} includeLastCompletedRequest - Whether to include details about the agents' most recent completed work
330 * @param {string[]} propertyFilters - Filter which custom properties will be returned
331 * @param {string[]} demands - Filter by demands the agents can satisfy
332 */
333 getAgents(poolId, agentName, includeCapabilities, includeAssignedRequest, includeLastCompletedRequest, propertyFilters, demands) {
334 return __awaiter(this, void 0, void 0, function* () {
335 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
336 let routeValues = {
337 poolId: poolId
338 };
339 let queryValues = {
340 agentName: agentName,
341 includeCapabilities: includeCapabilities,
342 includeAssignedRequest: includeAssignedRequest,
343 includeLastCompletedRequest: includeLastCompletedRequest,
344 propertyFilters: propertyFilters && propertyFilters.join(","),
345 demands: demands && demands.join(","),
346 };
347 try {
348 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues, queryValues);
349 let url = verData.requestUrl;
350 let options = this.createRequestOptions('application/json', verData.apiVersion);
351 let res;
352 res = yield this.rest.get(url, options);
353 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, true);
354 resolve(ret);
355 }
356 catch (err) {
357 reject(err);
358 }
359 }));
360 });
361 }
362 /**
363 * Replace an agent. You probably don't want to call this endpoint directly. Instead, [use the agent configuration script](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) to remove and reconfigure an agent from your organization.
364 *
365 * @param {TaskAgentInterfaces.TaskAgent} agent - Updated details about the replacing agent
366 * @param {number} poolId - The agent pool to use
367 * @param {number} agentId - The agent to replace
368 */
369 replaceAgent(agent, poolId, agentId) {
370 return __awaiter(this, void 0, void 0, function* () {
371 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
372 let routeValues = {
373 poolId: poolId,
374 agentId: agentId
375 };
376 try {
377 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues);
378 let url = verData.requestUrl;
379 let options = this.createRequestOptions('application/json', verData.apiVersion);
380 let res;
381 res = yield this.rest.replace(url, agent, options);
382 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false);
383 resolve(ret);
384 }
385 catch (err) {
386 reject(err);
387 }
388 }));
389 });
390 }
391 /**
392 * Update agent details.
393 *
394 * @param {TaskAgentInterfaces.TaskAgent} agent - Updated details about the agent
395 * @param {number} poolId - The agent pool to use
396 * @param {number} agentId - The agent to update
397 */
398 updateAgent(agent, poolId, agentId) {
399 return __awaiter(this, void 0, void 0, function* () {
400 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
401 let routeValues = {
402 poolId: poolId,
403 agentId: agentId
404 };
405 try {
406 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues);
407 let url = verData.requestUrl;
408 let options = this.createRequestOptions('application/json', verData.apiVersion);
409 let res;
410 res = yield this.rest.update(url, agent, options);
411 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false);
412 resolve(ret);
413 }
414 catch (err) {
415 reject(err);
416 }
417 }));
418 });
419 }
420 /**
421 * Returns list of azure subscriptions
422 *
423 */
424 getAzureManagementGroups() {
425 return __awaiter(this, void 0, void 0, function* () {
426 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
427 let routeValues = {};
428 try {
429 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "39fe3bf2-7ee0-4198-a469-4a29929afa9c", routeValues);
430 let url = verData.requestUrl;
431 let options = this.createRequestOptions('application/json', verData.apiVersion);
432 let res;
433 res = yield this.rest.get(url, options);
434 let ret = this.formatResponse(res.result, null, false);
435 resolve(ret);
436 }
437 catch (err) {
438 reject(err);
439 }
440 }));
441 });
442 }
443 /**
444 * Returns list of azure subscriptions
445 *
446 */
447 getAzureSubscriptions() {
448 return __awaiter(this, void 0, void 0, function* () {
449 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
450 let routeValues = {};
451 try {
452 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bcd6189c-0303-471f-a8e1-acb22b74d700", routeValues);
453 let url = verData.requestUrl;
454 let options = this.createRequestOptions('application/json', verData.apiVersion);
455 let res;
456 res = yield this.rest.get(url, options);
457 let ret = this.formatResponse(res.result, null, false);
458 resolve(ret);
459 }
460 catch (err) {
461 reject(err);
462 }
463 }));
464 });
465 }
466 /**
467 * GET a PAT token for managing (configuring, removing, tagging) deployment targets in a deployment group.
468 *
469 * @param {string} project - Project ID or project name
470 * @param {number} deploymentGroupId - ID of the deployment group in which deployment targets are managed.
471 */
472 generateDeploymentGroupAccessToken(project, deploymentGroupId) {
473 return __awaiter(this, void 0, void 0, function* () {
474 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
475 let routeValues = {
476 project: project,
477 deploymentGroupId: deploymentGroupId
478 };
479 try {
480 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "3d197ba2-c3e9-4253-882f-0ee2440f8174", routeValues);
481 let url = verData.requestUrl;
482 let options = this.createRequestOptions('application/json', verData.apiVersion);
483 let res;
484 res = yield this.rest.create(url, null, options);
485 let ret = this.formatResponse(res.result, null, false);
486 resolve(ret);
487 }
488 catch (err) {
489 reject(err);
490 }
491 }));
492 });
493 }
494 /**
495 * Create a deployment group.
496 *
497 * @param {TaskAgentInterfaces.DeploymentGroupCreateParameter} deploymentGroup - Deployment group to create.
498 * @param {string} project - Project ID or project name
499 */
500 addDeploymentGroup(deploymentGroup, project) {
501 return __awaiter(this, void 0, void 0, function* () {
502 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
503 let routeValues = {
504 project: project
505 };
506 try {
507 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues);
508 let url = verData.requestUrl;
509 let options = this.createRequestOptions('application/json', verData.apiVersion);
510 let res;
511 res = yield this.rest.create(url, deploymentGroup, options);
512 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, false);
513 resolve(ret);
514 }
515 catch (err) {
516 reject(err);
517 }
518 }));
519 });
520 }
521 /**
522 * Delete a deployment group.
523 *
524 * @param {string} project - Project ID or project name
525 * @param {number} deploymentGroupId - ID of the deployment group to be deleted.
526 */
527 deleteDeploymentGroup(project, deploymentGroupId) {
528 return __awaiter(this, void 0, void 0, function* () {
529 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
530 let routeValues = {
531 project: project,
532 deploymentGroupId: deploymentGroupId
533 };
534 try {
535 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues);
536 let url = verData.requestUrl;
537 let options = this.createRequestOptions('application/json', verData.apiVersion);
538 let res;
539 res = yield this.rest.del(url, options);
540 let ret = this.formatResponse(res.result, null, false);
541 resolve(ret);
542 }
543 catch (err) {
544 reject(err);
545 }
546 }));
547 });
548 }
549 /**
550 * Get a deployment group by its ID.
551 *
552 * @param {string} project - Project ID or project name
553 * @param {number} deploymentGroupId - ID of the deployment group.
554 * @param {TaskAgentInterfaces.DeploymentGroupActionFilter} actionFilter - Get the deployment group only if this action can be performed on it.
555 * @param {TaskAgentInterfaces.DeploymentGroupExpands} expand - Include these additional details in the returned object.
556 */
557 getDeploymentGroup(project, deploymentGroupId, actionFilter, expand) {
558 return __awaiter(this, void 0, void 0, function* () {
559 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
560 let routeValues = {
561 project: project,
562 deploymentGroupId: deploymentGroupId
563 };
564 let queryValues = {
565 actionFilter: actionFilter,
566 '$expand': expand,
567 };
568 try {
569 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues, queryValues);
570 let url = verData.requestUrl;
571 let options = this.createRequestOptions('application/json', verData.apiVersion);
572 let res;
573 res = yield this.rest.get(url, options);
574 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, false);
575 resolve(ret);
576 }
577 catch (err) {
578 reject(err);
579 }
580 }));
581 });
582 }
583 /**
584 * Get a list of deployment groups by name or IDs.
585 *
586 * @param {string} project - Project ID or project name
587 * @param {string} name - Name of the deployment group.
588 * @param {TaskAgentInterfaces.DeploymentGroupActionFilter} actionFilter - Get only deployment groups on which this action can be performed.
589 * @param {TaskAgentInterfaces.DeploymentGroupExpands} expand - Include these additional details in the returned objects.
590 * @param {string} continuationToken - Get deployment groups with names greater than this continuationToken lexicographically.
591 * @param {number} top - Maximum number of deployment groups to return. Default is **1000**.
592 * @param {number[]} ids - Comma separated list of IDs of the deployment groups.
593 */
594 getDeploymentGroups(project, name, actionFilter, expand, continuationToken, top, ids) {
595 return __awaiter(this, void 0, void 0, function* () {
596 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
597 let routeValues = {
598 project: project
599 };
600 let queryValues = {
601 name: name,
602 actionFilter: actionFilter,
603 '$expand': expand,
604 continuationToken: continuationToken,
605 '$top': top,
606 ids: ids && ids.join(","),
607 };
608 try {
609 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues, queryValues);
610 let url = verData.requestUrl;
611 let options = this.createRequestOptions('application/json', verData.apiVersion);
612 let res;
613 res = yield this.rest.get(url, options);
614 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, true);
615 resolve(ret);
616 }
617 catch (err) {
618 reject(err);
619 }
620 }));
621 });
622 }
623 /**
624 * Update a deployment group.
625 *
626 * @param {TaskAgentInterfaces.DeploymentGroupUpdateParameter} deploymentGroup - Deployment group to update.
627 * @param {string} project - Project ID or project name
628 * @param {number} deploymentGroupId - ID of the deployment group.
629 */
630 updateDeploymentGroup(deploymentGroup, project, deploymentGroupId) {
631 return __awaiter(this, void 0, void 0, function* () {
632 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
633 let routeValues = {
634 project: project,
635 deploymentGroupId: deploymentGroupId
636 };
637 try {
638 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues);
639 let url = verData.requestUrl;
640 let options = this.createRequestOptions('application/json', verData.apiVersion);
641 let res;
642 res = yield this.rest.update(url, deploymentGroup, options);
643 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, false);
644 resolve(ret);
645 }
646 catch (err) {
647 reject(err);
648 }
649 }));
650 });
651 }
652 /**
653 * Get a list of deployment group metrics.
654 *
655 * @param {string} project - Project ID or project name
656 * @param {string} deploymentGroupName - Name of the deployment group.
657 * @param {string} continuationToken - Get metrics for deployment groups with names greater than this continuationToken lexicographically.
658 * @param {number} top - Maximum number of deployment group metrics to return. Default is **50**.
659 */
660 getDeploymentGroupsMetrics(project, deploymentGroupName, continuationToken, top) {
661 return __awaiter(this, void 0, void 0, function* () {
662 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
663 let routeValues = {
664 project: project
665 };
666 let queryValues = {
667 deploymentGroupName: deploymentGroupName,
668 continuationToken: continuationToken,
669 '$top': top,
670 };
671 try {
672 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "281c6308-427a-49e1-b83a-dac0f4862189", routeValues, queryValues);
673 let url = verData.requestUrl;
674 let options = this.createRequestOptions('application/json', verData.apiVersion);
675 let res;
676 res = yield this.rest.get(url, options);
677 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroupMetrics, true);
678 resolve(ret);
679 }
680 catch (err) {
681 reject(err);
682 }
683 }));
684 });
685 }
686 /**
687 * @param {string} project - Project ID or project name
688 * @param {number} deploymentGroupId
689 * @param {number} machineId
690 * @param {number} completedRequestCount
691 */
692 getAgentRequestsForDeploymentMachine(project, deploymentGroupId, machineId, completedRequestCount) {
693 return __awaiter(this, void 0, void 0, function* () {
694 if (machineId == null) {
695 throw new TypeError('machineId can not be null or undefined');
696 }
697 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
698 let routeValues = {
699 project: project,
700 deploymentGroupId: deploymentGroupId
701 };
702 let queryValues = {
703 machineId: machineId,
704 completedRequestCount: completedRequestCount,
705 };
706 try {
707 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a3540e5b-f0dc-4668-963b-b752459be545", routeValues, queryValues);
708 let url = verData.requestUrl;
709 let options = this.createRequestOptions('application/json', verData.apiVersion);
710 let res;
711 res = yield this.rest.get(url, options);
712 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
713 resolve(ret);
714 }
715 catch (err) {
716 reject(err);
717 }
718 }));
719 });
720 }
721 /**
722 * @param {string} project - Project ID or project name
723 * @param {number} deploymentGroupId
724 * @param {number[]} machineIds
725 * @param {number} completedRequestCount
726 */
727 getAgentRequestsForDeploymentMachines(project, deploymentGroupId, machineIds, completedRequestCount) {
728 return __awaiter(this, void 0, void 0, function* () {
729 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
730 let routeValues = {
731 project: project,
732 deploymentGroupId: deploymentGroupId
733 };
734 let queryValues = {
735 machineIds: machineIds && machineIds.join(","),
736 completedRequestCount: completedRequestCount,
737 };
738 try {
739 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a3540e5b-f0dc-4668-963b-b752459be545", routeValues, queryValues);
740 let url = verData.requestUrl;
741 let options = this.createRequestOptions('application/json', verData.apiVersion);
742 let res;
743 res = yield this.rest.get(url, options);
744 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
745 resolve(ret);
746 }
747 catch (err) {
748 reject(err);
749 }
750 }));
751 });
752 }
753 /**
754 * @param {string} project - Project ID or project name
755 * @param {number} deploymentGroupId
756 */
757 refreshDeploymentMachines(project, deploymentGroupId) {
758 return __awaiter(this, void 0, void 0, function* () {
759 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
760 let routeValues = {
761 project: project,
762 deploymentGroupId: deploymentGroupId
763 };
764 try {
765 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "91006ac4-0f68-4d82-a2bc-540676bd73ce", routeValues);
766 let url = verData.requestUrl;
767 let options = this.createRequestOptions('application/json', verData.apiVersion);
768 let res;
769 res = yield this.rest.create(url, null, options);
770 let ret = this.formatResponse(res.result, null, false);
771 resolve(ret);
772 }
773 catch (err) {
774 reject(err);
775 }
776 }));
777 });
778 }
779 /**
780 * GET a PAT token for managing (configuring, removing, tagging) deployment agents in a deployment pool.
781 *
782 * @param {number} poolId - ID of the deployment pool in which deployment agents are managed.
783 */
784 generateDeploymentPoolAccessToken(poolId) {
785 return __awaiter(this, void 0, void 0, function* () {
786 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
787 let routeValues = {
788 poolId: poolId
789 };
790 try {
791 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e077ee4a-399b-420b-841f-c43fbc058e0b", routeValues);
792 let url = verData.requestUrl;
793 let options = this.createRequestOptions('application/json', verData.apiVersion);
794 let res;
795 res = yield this.rest.create(url, null, options);
796 let ret = this.formatResponse(res.result, null, false);
797 resolve(ret);
798 }
799 catch (err) {
800 reject(err);
801 }
802 }));
803 });
804 }
805 /**
806 * Get a list of deployment pool summaries.
807 *
808 * @param {string} poolName - Name of the deployment pool.
809 * @param {TaskAgentInterfaces.DeploymentPoolSummaryExpands} expands - Include these additional details in the returned objects.
810 * @param {number[]} poolIds - List of deployment pool ids.
811 */
812 getDeploymentPoolsSummary(poolName, expands, poolIds) {
813 return __awaiter(this, void 0, void 0, function* () {
814 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
815 let routeValues = {};
816 let queryValues = {
817 poolName: poolName,
818 expands: expands,
819 poolIds: poolIds && poolIds.join(","),
820 };
821 try {
822 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6525d6c6-258f-40e0-a1a9-8a24a3957625", routeValues, queryValues);
823 let url = verData.requestUrl;
824 let options = this.createRequestOptions('application/json', verData.apiVersion);
825 let res;
826 res = yield this.rest.get(url, options);
827 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentPoolSummary, true);
828 resolve(ret);
829 }
830 catch (err) {
831 reject(err);
832 }
833 }));
834 });
835 }
836 /**
837 * Get agent requests for a deployment target.
838 *
839 * @param {string} project - Project ID or project name
840 * @param {number} deploymentGroupId - ID of the deployment group to which the target belongs.
841 * @param {number} targetId - ID of the deployment target.
842 * @param {number} completedRequestCount - Maximum number of completed requests to return. Default is **50**
843 */
844 getAgentRequestsForDeploymentTarget(project, deploymentGroupId, targetId, completedRequestCount) {
845 return __awaiter(this, void 0, void 0, function* () {
846 if (targetId == null) {
847 throw new TypeError('targetId can not be null or undefined');
848 }
849 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
850 let routeValues = {
851 project: project,
852 deploymentGroupId: deploymentGroupId
853 };
854 let queryValues = {
855 targetId: targetId,
856 completedRequestCount: completedRequestCount,
857 };
858 try {
859 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2fac0be3-8c8f-4473-ab93-c1389b08a2c9", routeValues, queryValues);
860 let url = verData.requestUrl;
861 let options = this.createRequestOptions('application/json', verData.apiVersion);
862 let res;
863 res = yield this.rest.get(url, options);
864 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
865 resolve(ret);
866 }
867 catch (err) {
868 reject(err);
869 }
870 }));
871 });
872 }
873 /**
874 * Get agent requests for a list deployment targets.
875 *
876 * @param {string} project - Project ID or project name
877 * @param {number} deploymentGroupId - ID of the deployment group to which the targets belong.
878 * @param {number[]} targetIds - Comma separated list of IDs of the deployment targets.
879 * @param {number} ownerId - Id of owner of agent job request.
880 * @param {Date} completedOn - Datetime to return request after this time.
881 * @param {number} completedRequestCount - Maximum number of completed requests to return for each target. Default is **50**
882 */
883 getAgentRequestsForDeploymentTargets(project, deploymentGroupId, targetIds, ownerId, completedOn, completedRequestCount) {
884 return __awaiter(this, void 0, void 0, function* () {
885 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
886 let routeValues = {
887 project: project,
888 deploymentGroupId: deploymentGroupId
889 };
890 let queryValues = {
891 targetIds: targetIds && targetIds.join(","),
892 ownerId: ownerId,
893 completedOn: completedOn,
894 completedRequestCount: completedRequestCount,
895 };
896 try {
897 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2fac0be3-8c8f-4473-ab93-c1389b08a2c9", routeValues, queryValues);
898 let url = verData.requestUrl;
899 let options = this.createRequestOptions('application/json', verData.apiVersion);
900 let res;
901 res = yield this.rest.get(url, options);
902 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
903 resolve(ret);
904 }
905 catch (err) {
906 reject(err);
907 }
908 }));
909 });
910 }
911 /**
912 * Upgrade the deployment targets in a deployment group.
913 *
914 * @param {string} project - Project ID or project name
915 * @param {number} deploymentGroupId - ID of the deployment group.
916 */
917 refreshDeploymentTargets(project, deploymentGroupId) {
918 return __awaiter(this, void 0, void 0, function* () {
919 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
920 let routeValues = {
921 project: project,
922 deploymentGroupId: deploymentGroupId
923 };
924 try {
925 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "1c1a817f-f23d-41c6-bf8d-14b638f64152", routeValues);
926 let url = verData.requestUrl;
927 let options = this.createRequestOptions('application/json', verData.apiVersion);
928 let res;
929 res = yield this.rest.create(url, null, options);
930 let ret = this.formatResponse(res.result, null, false);
931 resolve(ret);
932 }
933 catch (err) {
934 reject(err);
935 }
936 }));
937 });
938 }
939 /**
940 * Proxy for a GET request defined by an 'endpoint'. The request is authorized using a service connection. The response is filtered using an XPath/Json based selector.
941 *
942 * @param {TaskAgentInterfaces.TaskDefinitionEndpoint} endpoint - Describes the URL to fetch.
943 */
944 queryEndpoint(endpoint) {
945 return __awaiter(this, void 0, void 0, function* () {
946 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
947 let routeValues = {};
948 try {
949 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f223b809-8c33-4b7d-b53f-07232569b5d6", routeValues);
950 let url = verData.requestUrl;
951 let options = this.createRequestOptions('application/json', verData.apiVersion);
952 let res;
953 res = yield this.rest.create(url, endpoint, options);
954 let ret = this.formatResponse(res.result, null, true);
955 resolve(ret);
956 }
957 catch (err) {
958 reject(err);
959 }
960 }));
961 });
962 }
963 /**
964 * Get environment deployment execution history
965 *
966 * @param {string} project - Project ID or project name
967 * @param {number} environmentId
968 * @param {string} continuationToken
969 * @param {number} top
970 */
971 getEnvironmentDeploymentExecutionRecords(project, environmentId, continuationToken, top) {
972 return __awaiter(this, void 0, void 0, function* () {
973 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
974 let routeValues = {
975 project: project,
976 environmentId: environmentId
977 };
978 let queryValues = {
979 continuationToken: continuationToken,
980 top: top,
981 };
982 try {
983 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "51bb5d21-4305-4ea6-9dbb-b7488af73334", routeValues, queryValues);
984 let url = verData.requestUrl;
985 let options = this.createRequestOptions('application/json', verData.apiVersion);
986 let res;
987 res = yield this.rest.get(url, options);
988 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentDeploymentExecutionRecord, true);
989 resolve(ret);
990 }
991 catch (err) {
992 reject(err);
993 }
994 }));
995 });
996 }
997 /**
998 * Create an environment.
999 *
1000 * @param {TaskAgentInterfaces.EnvironmentCreateParameter} environmentCreateParameter - Environment to create.
1001 * @param {string} project - Project ID or project name
1002 */
1003 addEnvironment(environmentCreateParameter, project) {
1004 return __awaiter(this, void 0, void 0, function* () {
1005 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1006 let routeValues = {
1007 project: project
1008 };
1009 try {
1010 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues);
1011 let url = verData.requestUrl;
1012 let options = this.createRequestOptions('application/json', verData.apiVersion);
1013 let res;
1014 res = yield this.rest.create(url, environmentCreateParameter, options);
1015 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, false);
1016 resolve(ret);
1017 }
1018 catch (err) {
1019 reject(err);
1020 }
1021 }));
1022 });
1023 }
1024 /**
1025 * Delete the specified environment.
1026 *
1027 * @param {string} project - Project ID or project name
1028 * @param {number} environmentId - ID of the environment.
1029 */
1030 deleteEnvironment(project, environmentId) {
1031 return __awaiter(this, void 0, void 0, function* () {
1032 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1033 let routeValues = {
1034 project: project,
1035 environmentId: environmentId
1036 };
1037 try {
1038 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues);
1039 let url = verData.requestUrl;
1040 let options = this.createRequestOptions('application/json', verData.apiVersion);
1041 let res;
1042 res = yield this.rest.del(url, options);
1043 let ret = this.formatResponse(res.result, null, false);
1044 resolve(ret);
1045 }
1046 catch (err) {
1047 reject(err);
1048 }
1049 }));
1050 });
1051 }
1052 /**
1053 * Get an environment by its ID.
1054 *
1055 * @param {string} project - Project ID or project name
1056 * @param {number} environmentId - ID of the environment.
1057 * @param {TaskAgentInterfaces.EnvironmentExpands} expands - Include these additional details in the returned objects.
1058 */
1059 getEnvironmentById(project, environmentId, expands) {
1060 return __awaiter(this, void 0, void 0, function* () {
1061 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1062 let routeValues = {
1063 project: project,
1064 environmentId: environmentId
1065 };
1066 let queryValues = {
1067 expands: expands,
1068 };
1069 try {
1070 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues, queryValues);
1071 let url = verData.requestUrl;
1072 let options = this.createRequestOptions('application/json', verData.apiVersion);
1073 let res;
1074 res = yield this.rest.get(url, options);
1075 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, false);
1076 resolve(ret);
1077 }
1078 catch (err) {
1079 reject(err);
1080 }
1081 }));
1082 });
1083 }
1084 /**
1085 * Get all environments.
1086 *
1087 * @param {string} project - Project ID or project name
1088 * @param {string} name
1089 * @param {string} continuationToken
1090 * @param {number} top
1091 */
1092 getEnvironments(project, name, continuationToken, top) {
1093 return __awaiter(this, void 0, void 0, function* () {
1094 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1095 let routeValues = {
1096 project: project
1097 };
1098 let queryValues = {
1099 name: name,
1100 continuationToken: continuationToken,
1101 '$top': top,
1102 };
1103 try {
1104 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues, queryValues);
1105 let url = verData.requestUrl;
1106 let options = this.createRequestOptions('application/json', verData.apiVersion);
1107 let res;
1108 res = yield this.rest.get(url, options);
1109 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, true);
1110 resolve(ret);
1111 }
1112 catch (err) {
1113 reject(err);
1114 }
1115 }));
1116 });
1117 }
1118 /**
1119 * Update the specified environment.
1120 *
1121 * @param {TaskAgentInterfaces.EnvironmentUpdateParameter} environmentUpdateParameter - Environment data to update.
1122 * @param {string} project - Project ID or project name
1123 * @param {number} environmentId - ID of the environment.
1124 */
1125 updateEnvironment(environmentUpdateParameter, project, environmentId) {
1126 return __awaiter(this, void 0, void 0, function* () {
1127 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1128 let routeValues = {
1129 project: project,
1130 environmentId: environmentId
1131 };
1132 try {
1133 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues);
1134 let url = verData.requestUrl;
1135 let options = this.createRequestOptions('application/json', verData.apiVersion);
1136 let res;
1137 res = yield this.rest.update(url, environmentUpdateParameter, options);
1138 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, false);
1139 resolve(ret);
1140 }
1141 catch (err) {
1142 reject(err);
1143 }
1144 }));
1145 });
1146 }
1147 /**
1148 * @param {string} hubName
1149 * @param {boolean} includeEnterpriseUsersCount
1150 * @param {boolean} includeHostedAgentMinutesCount
1151 */
1152 getTaskHubLicenseDetails(hubName, includeEnterpriseUsersCount, includeHostedAgentMinutesCount) {
1153 return __awaiter(this, void 0, void 0, function* () {
1154 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1155 let routeValues = {
1156 hubName: hubName
1157 };
1158 let queryValues = {
1159 includeEnterpriseUsersCount: includeEnterpriseUsersCount,
1160 includeHostedAgentMinutesCount: includeHostedAgentMinutesCount,
1161 };
1162 try {
1163 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "distributedtask", "f9f0f436-b8a1-4475-9041-1ccdbf8f0128", routeValues, queryValues);
1164 let url = verData.requestUrl;
1165 let options = this.createRequestOptions('application/json', verData.apiVersion);
1166 let res;
1167 res = yield this.rest.get(url, options);
1168 let ret = this.formatResponse(res.result, null, false);
1169 resolve(ret);
1170 }
1171 catch (err) {
1172 reject(err);
1173 }
1174 }));
1175 });
1176 }
1177 /**
1178 * @param {TaskAgentInterfaces.TaskHubLicenseDetails} taskHubLicenseDetails
1179 * @param {string} hubName
1180 */
1181 updateTaskHubLicenseDetails(taskHubLicenseDetails, hubName) {
1182 return __awaiter(this, void 0, void 0, function* () {
1183 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1184 let routeValues = {
1185 hubName: hubName
1186 };
1187 try {
1188 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "distributedtask", "f9f0f436-b8a1-4475-9041-1ccdbf8f0128", routeValues);
1189 let url = verData.requestUrl;
1190 let options = this.createRequestOptions('application/json', verData.apiVersion);
1191 let res;
1192 res = yield this.rest.replace(url, taskHubLicenseDetails, options);
1193 let ret = this.formatResponse(res.result, null, false);
1194 resolve(ret);
1195 }
1196 catch (err) {
1197 reject(err);
1198 }
1199 }));
1200 });
1201 }
1202 /**
1203 * @param {TaskAgentInterfaces.InputValidationRequest} inputValidationRequest
1204 */
1205 validateInputs(inputValidationRequest) {
1206 return __awaiter(this, void 0, void 0, function* () {
1207 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1208 let routeValues = {};
1209 try {
1210 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "58475b1e-adaf-4155-9bc1-e04bf1fff4c2", routeValues);
1211 let url = verData.requestUrl;
1212 let options = this.createRequestOptions('application/json', verData.apiVersion);
1213 let res;
1214 res = yield this.rest.create(url, inputValidationRequest, options);
1215 let ret = this.formatResponse(res.result, null, false);
1216 resolve(ret);
1217 }
1218 catch (err) {
1219 reject(err);
1220 }
1221 }));
1222 });
1223 }
1224 /**
1225 * @param {number} poolId
1226 * @param {number} requestId
1227 * @param {string} lockToken
1228 * @param {TaskAgentInterfaces.TaskResult} result
1229 * @param {boolean} agentShuttingDown
1230 */
1231 deleteAgentRequest(poolId, requestId, lockToken, result, agentShuttingDown) {
1232 return __awaiter(this, void 0, void 0, function* () {
1233 if (lockToken == null) {
1234 throw new TypeError('lockToken can not be null or undefined');
1235 }
1236 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1237 let routeValues = {
1238 poolId: poolId,
1239 requestId: requestId
1240 };
1241 let queryValues = {
1242 lockToken: lockToken,
1243 result: result,
1244 agentShuttingDown: agentShuttingDown,
1245 };
1246 try {
1247 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1248 let url = verData.requestUrl;
1249 let options = this.createRequestOptions('application/json', verData.apiVersion);
1250 let res;
1251 res = yield this.rest.del(url, options);
1252 let ret = this.formatResponse(res.result, null, false);
1253 resolve(ret);
1254 }
1255 catch (err) {
1256 reject(err);
1257 }
1258 }));
1259 });
1260 }
1261 /**
1262 * @param {number} poolId
1263 * @param {number} requestId
1264 * @param {boolean} includeStatus
1265 */
1266 getAgentRequest(poolId, requestId, includeStatus) {
1267 return __awaiter(this, void 0, void 0, function* () {
1268 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1269 let routeValues = {
1270 poolId: poolId,
1271 requestId: requestId
1272 };
1273 let queryValues = {
1274 includeStatus: includeStatus,
1275 };
1276 try {
1277 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1278 let url = verData.requestUrl;
1279 let options = this.createRequestOptions('application/json', verData.apiVersion);
1280 let res;
1281 res = yield this.rest.get(url, options);
1282 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false);
1283 resolve(ret);
1284 }
1285 catch (err) {
1286 reject(err);
1287 }
1288 }));
1289 });
1290 }
1291 /**
1292 * @param {number} poolId
1293 * @param {number} top
1294 * @param {string} continuationToken
1295 */
1296 getAgentRequests(poolId, top, continuationToken) {
1297 return __awaiter(this, void 0, void 0, function* () {
1298 if (top == null) {
1299 throw new TypeError('top can not be null or undefined');
1300 }
1301 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1302 let routeValues = {
1303 poolId: poolId
1304 };
1305 let queryValues = {
1306 '$top': top,
1307 continuationToken: continuationToken,
1308 };
1309 try {
1310 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1311 let url = verData.requestUrl;
1312 let options = this.createRequestOptions('application/json', verData.apiVersion);
1313 let res;
1314 res = yield this.rest.get(url, options);
1315 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
1316 resolve(ret);
1317 }
1318 catch (err) {
1319 reject(err);
1320 }
1321 }));
1322 });
1323 }
1324 /**
1325 * @param {number} poolId
1326 * @param {number} agentId
1327 * @param {number} completedRequestCount
1328 */
1329 getAgentRequestsForAgent(poolId, agentId, completedRequestCount) {
1330 return __awaiter(this, void 0, void 0, function* () {
1331 if (agentId == null) {
1332 throw new TypeError('agentId can not be null or undefined');
1333 }
1334 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1335 let routeValues = {
1336 poolId: poolId
1337 };
1338 let queryValues = {
1339 agentId: agentId,
1340 completedRequestCount: completedRequestCount,
1341 };
1342 try {
1343 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1344 let url = verData.requestUrl;
1345 let options = this.createRequestOptions('application/json', verData.apiVersion);
1346 let res;
1347 res = yield this.rest.get(url, options);
1348 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
1349 resolve(ret);
1350 }
1351 catch (err) {
1352 reject(err);
1353 }
1354 }));
1355 });
1356 }
1357 /**
1358 * @param {number} poolId
1359 * @param {number[]} agentIds
1360 * @param {number} completedRequestCount
1361 */
1362 getAgentRequestsForAgents(poolId, agentIds, completedRequestCount) {
1363 return __awaiter(this, void 0, void 0, function* () {
1364 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1365 let routeValues = {
1366 poolId: poolId
1367 };
1368 let queryValues = {
1369 agentIds: agentIds && agentIds.join(","),
1370 completedRequestCount: completedRequestCount,
1371 };
1372 try {
1373 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1374 let url = verData.requestUrl;
1375 let options = this.createRequestOptions('application/json', verData.apiVersion);
1376 let res;
1377 res = yield this.rest.get(url, options);
1378 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
1379 resolve(ret);
1380 }
1381 catch (err) {
1382 reject(err);
1383 }
1384 }));
1385 });
1386 }
1387 /**
1388 * @param {number} poolId
1389 * @param {string} planId
1390 * @param {string} jobId
1391 */
1392 getAgentRequestsForPlan(poolId, planId, jobId) {
1393 return __awaiter(this, void 0, void 0, function* () {
1394 if (planId == null) {
1395 throw new TypeError('planId can not be null or undefined');
1396 }
1397 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1398 let routeValues = {
1399 poolId: poolId
1400 };
1401 let queryValues = {
1402 planId: planId,
1403 jobId: jobId,
1404 };
1405 try {
1406 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1407 let url = verData.requestUrl;
1408 let options = this.createRequestOptions('application/json', verData.apiVersion);
1409 let res;
1410 res = yield this.rest.get(url, options);
1411 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true);
1412 resolve(ret);
1413 }
1414 catch (err) {
1415 reject(err);
1416 }
1417 }));
1418 });
1419 }
1420 /**
1421 * @param {TaskAgentInterfaces.TaskAgentJobRequest} request
1422 * @param {number} poolId
1423 */
1424 queueAgentRequestByPool(request, poolId) {
1425 return __awaiter(this, void 0, void 0, function* () {
1426 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1427 let routeValues = {
1428 poolId: poolId
1429 };
1430 try {
1431 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues);
1432 let url = verData.requestUrl;
1433 let options = this.createRequestOptions('application/json', verData.apiVersion);
1434 let res;
1435 res = yield this.rest.create(url, request, options);
1436 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false);
1437 resolve(ret);
1438 }
1439 catch (err) {
1440 reject(err);
1441 }
1442 }));
1443 });
1444 }
1445 /**
1446 * @param {TaskAgentInterfaces.TaskAgentJobRequest} request
1447 * @param {number} poolId
1448 * @param {number} requestId
1449 * @param {string} lockToken
1450 * @param {TaskAgentInterfaces.TaskAgentRequestUpdateOptions} updateOptions
1451 */
1452 updateAgentRequest(request, poolId, requestId, lockToken, updateOptions) {
1453 return __awaiter(this, void 0, void 0, function* () {
1454 if (lockToken == null) {
1455 throw new TypeError('lockToken can not be null or undefined');
1456 }
1457 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1458 let routeValues = {
1459 poolId: poolId,
1460 requestId: requestId
1461 };
1462 let queryValues = {
1463 lockToken: lockToken,
1464 updateOptions: updateOptions,
1465 };
1466 try {
1467 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues);
1468 let url = verData.requestUrl;
1469 let options = this.createRequestOptions('application/json', verData.apiVersion);
1470 let res;
1471 res = yield this.rest.update(url, request, options);
1472 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false);
1473 resolve(ret);
1474 }
1475 catch (err) {
1476 reject(err);
1477 }
1478 }));
1479 });
1480 }
1481 /**
1482 * @param {TaskAgentInterfaces.KubernetesResourceCreateParameters} createParameters
1483 * @param {string} project - Project ID or project name
1484 * @param {number} environmentId
1485 */
1486 addKubernetesResource(createParameters, project, environmentId) {
1487 return __awaiter(this, void 0, void 0, function* () {
1488 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1489 let routeValues = {
1490 project: project,
1491 environmentId: environmentId
1492 };
1493 try {
1494 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "73fba52f-15ab-42b3-a538-ce67a9223a04", routeValues);
1495 let url = verData.requestUrl;
1496 let options = this.createRequestOptions('application/json', verData.apiVersion);
1497 let res;
1498 res = yield this.rest.create(url, createParameters, options);
1499 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.KubernetesResource, false);
1500 resolve(ret);
1501 }
1502 catch (err) {
1503 reject(err);
1504 }
1505 }));
1506 });
1507 }
1508 /**
1509 * @param {string} project - Project ID or project name
1510 * @param {number} environmentId
1511 * @param {number} resourceId
1512 */
1513 deleteKubernetesResource(project, environmentId, resourceId) {
1514 return __awaiter(this, void 0, void 0, function* () {
1515 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1516 let routeValues = {
1517 project: project,
1518 environmentId: environmentId,
1519 resourceId: resourceId
1520 };
1521 try {
1522 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "73fba52f-15ab-42b3-a538-ce67a9223a04", routeValues);
1523 let url = verData.requestUrl;
1524 let options = this.createRequestOptions('application/json', verData.apiVersion);
1525 let res;
1526 res = yield this.rest.del(url, options);
1527 let ret = this.formatResponse(res.result, null, false);
1528 resolve(ret);
1529 }
1530 catch (err) {
1531 reject(err);
1532 }
1533 }));
1534 });
1535 }
1536 /**
1537 * @param {string} project - Project ID or project name
1538 * @param {number} environmentId
1539 * @param {number} resourceId
1540 */
1541 getKubernetesResource(project, environmentId, resourceId) {
1542 return __awaiter(this, void 0, void 0, function* () {
1543 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1544 let routeValues = {
1545 project: project,
1546 environmentId: environmentId,
1547 resourceId: resourceId
1548 };
1549 try {
1550 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "73fba52f-15ab-42b3-a538-ce67a9223a04", routeValues);
1551 let url = verData.requestUrl;
1552 let options = this.createRequestOptions('application/json', verData.apiVersion);
1553 let res;
1554 res = yield this.rest.get(url, options);
1555 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.KubernetesResource, false);
1556 resolve(ret);
1557 }
1558 catch (err) {
1559 reject(err);
1560 }
1561 }));
1562 });
1563 }
1564 /**
1565 * @param {string} project - Project ID or project name
1566 * @param {number} machineGroupId
1567 */
1568 generateDeploymentMachineGroupAccessToken(project, machineGroupId) {
1569 return __awaiter(this, void 0, void 0, function* () {
1570 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1571 let routeValues = {
1572 project: project,
1573 machineGroupId: machineGroupId
1574 };
1575 try {
1576 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f8c7c0de-ac0d-469b-9cb1-c21f72d67693", routeValues);
1577 let url = verData.requestUrl;
1578 let options = this.createRequestOptions('application/json', verData.apiVersion);
1579 let res;
1580 res = yield this.rest.create(url, null, options);
1581 let ret = this.formatResponse(res.result, null, false);
1582 resolve(ret);
1583 }
1584 catch (err) {
1585 reject(err);
1586 }
1587 }));
1588 });
1589 }
1590 /**
1591 * @param {TaskAgentInterfaces.DeploymentMachineGroup} machineGroup
1592 * @param {string} project - Project ID or project name
1593 */
1594 addDeploymentMachineGroup(machineGroup, project) {
1595 return __awaiter(this, void 0, void 0, function* () {
1596 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1597 let routeValues = {
1598 project: project
1599 };
1600 try {
1601 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues);
1602 let url = verData.requestUrl;
1603 let options = this.createRequestOptions('application/json', verData.apiVersion);
1604 let res;
1605 res = yield this.rest.create(url, machineGroup, options);
1606 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, false);
1607 resolve(ret);
1608 }
1609 catch (err) {
1610 reject(err);
1611 }
1612 }));
1613 });
1614 }
1615 /**
1616 * @param {string} project - Project ID or project name
1617 * @param {number} machineGroupId
1618 */
1619 deleteDeploymentMachineGroup(project, machineGroupId) {
1620 return __awaiter(this, void 0, void 0, function* () {
1621 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1622 let routeValues = {
1623 project: project,
1624 machineGroupId: machineGroupId
1625 };
1626 try {
1627 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues);
1628 let url = verData.requestUrl;
1629 let options = this.createRequestOptions('application/json', verData.apiVersion);
1630 let res;
1631 res = yield this.rest.del(url, options);
1632 let ret = this.formatResponse(res.result, null, false);
1633 resolve(ret);
1634 }
1635 catch (err) {
1636 reject(err);
1637 }
1638 }));
1639 });
1640 }
1641 /**
1642 * @param {string} project - Project ID or project name
1643 * @param {number} machineGroupId
1644 * @param {TaskAgentInterfaces.MachineGroupActionFilter} actionFilter
1645 */
1646 getDeploymentMachineGroup(project, machineGroupId, actionFilter) {
1647 return __awaiter(this, void 0, void 0, function* () {
1648 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1649 let routeValues = {
1650 project: project,
1651 machineGroupId: machineGroupId
1652 };
1653 let queryValues = {
1654 actionFilter: actionFilter,
1655 };
1656 try {
1657 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues, queryValues);
1658 let url = verData.requestUrl;
1659 let options = this.createRequestOptions('application/json', verData.apiVersion);
1660 let res;
1661 res = yield this.rest.get(url, options);
1662 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, false);
1663 resolve(ret);
1664 }
1665 catch (err) {
1666 reject(err);
1667 }
1668 }));
1669 });
1670 }
1671 /**
1672 * @param {string} project - Project ID or project name
1673 * @param {string} machineGroupName
1674 * @param {TaskAgentInterfaces.MachineGroupActionFilter} actionFilter
1675 */
1676 getDeploymentMachineGroups(project, machineGroupName, actionFilter) {
1677 return __awaiter(this, void 0, void 0, function* () {
1678 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1679 let routeValues = {
1680 project: project
1681 };
1682 let queryValues = {
1683 machineGroupName: machineGroupName,
1684 actionFilter: actionFilter,
1685 };
1686 try {
1687 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues, queryValues);
1688 let url = verData.requestUrl;
1689 let options = this.createRequestOptions('application/json', verData.apiVersion);
1690 let res;
1691 res = yield this.rest.get(url, options);
1692 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, true);
1693 resolve(ret);
1694 }
1695 catch (err) {
1696 reject(err);
1697 }
1698 }));
1699 });
1700 }
1701 /**
1702 * @param {TaskAgentInterfaces.DeploymentMachineGroup} machineGroup
1703 * @param {string} project - Project ID or project name
1704 * @param {number} machineGroupId
1705 */
1706 updateDeploymentMachineGroup(machineGroup, project, machineGroupId) {
1707 return __awaiter(this, void 0, void 0, function* () {
1708 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1709 let routeValues = {
1710 project: project,
1711 machineGroupId: machineGroupId
1712 };
1713 try {
1714 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues);
1715 let url = verData.requestUrl;
1716 let options = this.createRequestOptions('application/json', verData.apiVersion);
1717 let res;
1718 res = yield this.rest.update(url, machineGroup, options);
1719 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, false);
1720 resolve(ret);
1721 }
1722 catch (err) {
1723 reject(err);
1724 }
1725 }));
1726 });
1727 }
1728 /**
1729 * @param {string} project - Project ID or project name
1730 * @param {number} machineGroupId
1731 * @param {string[]} tagFilters
1732 */
1733 getDeploymentMachineGroupMachines(project, machineGroupId, tagFilters) {
1734 return __awaiter(this, void 0, void 0, function* () {
1735 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1736 let routeValues = {
1737 project: project,
1738 machineGroupId: machineGroupId
1739 };
1740 let queryValues = {
1741 tagFilters: tagFilters && tagFilters.join(","),
1742 };
1743 try {
1744 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "966c3874-c347-4b18-a90c-d509116717fd", routeValues, queryValues);
1745 let url = verData.requestUrl;
1746 let options = this.createRequestOptions('application/json', verData.apiVersion);
1747 let res;
1748 res = yield this.rest.get(url, options);
1749 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true);
1750 resolve(ret);
1751 }
1752 catch (err) {
1753 reject(err);
1754 }
1755 }));
1756 });
1757 }
1758 /**
1759 * @param {TaskAgentInterfaces.DeploymentMachine[]} deploymentMachines
1760 * @param {string} project - Project ID or project name
1761 * @param {number} machineGroupId
1762 */
1763 updateDeploymentMachineGroupMachines(deploymentMachines, project, machineGroupId) {
1764 return __awaiter(this, void 0, void 0, function* () {
1765 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1766 let routeValues = {
1767 project: project,
1768 machineGroupId: machineGroupId
1769 };
1770 try {
1771 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "966c3874-c347-4b18-a90c-d509116717fd", routeValues);
1772 let url = verData.requestUrl;
1773 let options = this.createRequestOptions('application/json', verData.apiVersion);
1774 let res;
1775 res = yield this.rest.update(url, deploymentMachines, options);
1776 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true);
1777 resolve(ret);
1778 }
1779 catch (err) {
1780 reject(err);
1781 }
1782 }));
1783 });
1784 }
1785 /**
1786 * @param {TaskAgentInterfaces.DeploymentMachine} machine
1787 * @param {string} project - Project ID or project name
1788 * @param {number} deploymentGroupId
1789 */
1790 addDeploymentMachine(machine, project, deploymentGroupId) {
1791 return __awaiter(this, void 0, void 0, function* () {
1792 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1793 let routeValues = {
1794 project: project,
1795 deploymentGroupId: deploymentGroupId
1796 };
1797 try {
1798 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues);
1799 let url = verData.requestUrl;
1800 let options = this.createRequestOptions('application/json', verData.apiVersion);
1801 let res;
1802 res = yield this.rest.create(url, machine, options);
1803 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
1804 resolve(ret);
1805 }
1806 catch (err) {
1807 reject(err);
1808 }
1809 }));
1810 });
1811 }
1812 /**
1813 * @param {string} project - Project ID or project name
1814 * @param {number} deploymentGroupId
1815 * @param {number} machineId
1816 */
1817 deleteDeploymentMachine(project, deploymentGroupId, machineId) {
1818 return __awaiter(this, void 0, void 0, function* () {
1819 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1820 let routeValues = {
1821 project: project,
1822 deploymentGroupId: deploymentGroupId,
1823 machineId: machineId
1824 };
1825 try {
1826 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues);
1827 let url = verData.requestUrl;
1828 let options = this.createRequestOptions('application/json', verData.apiVersion);
1829 let res;
1830 res = yield this.rest.del(url, options);
1831 let ret = this.formatResponse(res.result, null, false);
1832 resolve(ret);
1833 }
1834 catch (err) {
1835 reject(err);
1836 }
1837 }));
1838 });
1839 }
1840 /**
1841 * @param {string} project - Project ID or project name
1842 * @param {number} deploymentGroupId
1843 * @param {number} machineId
1844 * @param {TaskAgentInterfaces.DeploymentMachineExpands} expand
1845 */
1846 getDeploymentMachine(project, deploymentGroupId, machineId, expand) {
1847 return __awaiter(this, void 0, void 0, function* () {
1848 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1849 let routeValues = {
1850 project: project,
1851 deploymentGroupId: deploymentGroupId,
1852 machineId: machineId
1853 };
1854 let queryValues = {
1855 '$expand': expand,
1856 };
1857 try {
1858 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues, queryValues);
1859 let url = verData.requestUrl;
1860 let options = this.createRequestOptions('application/json', verData.apiVersion);
1861 let res;
1862 res = yield this.rest.get(url, options);
1863 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
1864 resolve(ret);
1865 }
1866 catch (err) {
1867 reject(err);
1868 }
1869 }));
1870 });
1871 }
1872 /**
1873 * @param {string} project - Project ID or project name
1874 * @param {number} deploymentGroupId
1875 * @param {string[]} tags
1876 * @param {string} name
1877 * @param {TaskAgentInterfaces.DeploymentMachineExpands} expand
1878 */
1879 getDeploymentMachines(project, deploymentGroupId, tags, name, expand) {
1880 return __awaiter(this, void 0, void 0, function* () {
1881 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1882 let routeValues = {
1883 project: project,
1884 deploymentGroupId: deploymentGroupId
1885 };
1886 let queryValues = {
1887 tags: tags && tags.join(","),
1888 name: name,
1889 '$expand': expand,
1890 };
1891 try {
1892 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues, queryValues);
1893 let url = verData.requestUrl;
1894 let options = this.createRequestOptions('application/json', verData.apiVersion);
1895 let res;
1896 res = yield this.rest.get(url, options);
1897 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true);
1898 resolve(ret);
1899 }
1900 catch (err) {
1901 reject(err);
1902 }
1903 }));
1904 });
1905 }
1906 /**
1907 * @param {TaskAgentInterfaces.DeploymentMachine} machine
1908 * @param {string} project - Project ID or project name
1909 * @param {number} deploymentGroupId
1910 * @param {number} machineId
1911 */
1912 replaceDeploymentMachine(machine, project, deploymentGroupId, machineId) {
1913 return __awaiter(this, void 0, void 0, function* () {
1914 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1915 let routeValues = {
1916 project: project,
1917 deploymentGroupId: deploymentGroupId,
1918 machineId: machineId
1919 };
1920 try {
1921 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues);
1922 let url = verData.requestUrl;
1923 let options = this.createRequestOptions('application/json', verData.apiVersion);
1924 let res;
1925 res = yield this.rest.replace(url, machine, options);
1926 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
1927 resolve(ret);
1928 }
1929 catch (err) {
1930 reject(err);
1931 }
1932 }));
1933 });
1934 }
1935 /**
1936 * @param {TaskAgentInterfaces.DeploymentMachine} machine
1937 * @param {string} project - Project ID or project name
1938 * @param {number} deploymentGroupId
1939 * @param {number} machineId
1940 */
1941 updateDeploymentMachine(machine, project, deploymentGroupId, machineId) {
1942 return __awaiter(this, void 0, void 0, function* () {
1943 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1944 let routeValues = {
1945 project: project,
1946 deploymentGroupId: deploymentGroupId,
1947 machineId: machineId
1948 };
1949 try {
1950 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues);
1951 let url = verData.requestUrl;
1952 let options = this.createRequestOptions('application/json', verData.apiVersion);
1953 let res;
1954 res = yield this.rest.update(url, machine, options);
1955 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
1956 resolve(ret);
1957 }
1958 catch (err) {
1959 reject(err);
1960 }
1961 }));
1962 });
1963 }
1964 /**
1965 * @param {TaskAgentInterfaces.DeploymentMachine[]} machines
1966 * @param {string} project - Project ID or project name
1967 * @param {number} deploymentGroupId
1968 */
1969 updateDeploymentMachines(machines, project, deploymentGroupId) {
1970 return __awaiter(this, void 0, void 0, function* () {
1971 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1972 let routeValues = {
1973 project: project,
1974 deploymentGroupId: deploymentGroupId
1975 };
1976 try {
1977 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues);
1978 let url = verData.requestUrl;
1979 let options = this.createRequestOptions('application/json', verData.apiVersion);
1980 let res;
1981 res = yield this.rest.update(url, machines, options);
1982 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true);
1983 resolve(ret);
1984 }
1985 catch (err) {
1986 reject(err);
1987 }
1988 }));
1989 });
1990 }
1991 /**
1992 * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceDefinition} definition
1993 * @param {number} poolId
1994 */
1995 createAgentPoolMaintenanceDefinition(definition, poolId) {
1996 return __awaiter(this, void 0, void 0, function* () {
1997 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1998 let routeValues = {
1999 poolId: poolId
2000 };
2001 try {
2002 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues);
2003 let url = verData.requestUrl;
2004 let options = this.createRequestOptions('application/json', verData.apiVersion);
2005 let res;
2006 res = yield this.rest.create(url, definition, options);
2007 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, false);
2008 resolve(ret);
2009 }
2010 catch (err) {
2011 reject(err);
2012 }
2013 }));
2014 });
2015 }
2016 /**
2017 * @param {number} poolId
2018 * @param {number} definitionId
2019 */
2020 deleteAgentPoolMaintenanceDefinition(poolId, definitionId) {
2021 return __awaiter(this, void 0, void 0, function* () {
2022 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2023 let routeValues = {
2024 poolId: poolId,
2025 definitionId: definitionId
2026 };
2027 try {
2028 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues);
2029 let url = verData.requestUrl;
2030 let options = this.createRequestOptions('application/json', verData.apiVersion);
2031 let res;
2032 res = yield this.rest.del(url, options);
2033 let ret = this.formatResponse(res.result, null, false);
2034 resolve(ret);
2035 }
2036 catch (err) {
2037 reject(err);
2038 }
2039 }));
2040 });
2041 }
2042 /**
2043 * @param {number} poolId
2044 * @param {number} definitionId
2045 */
2046 getAgentPoolMaintenanceDefinition(poolId, definitionId) {
2047 return __awaiter(this, void 0, void 0, function* () {
2048 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2049 let routeValues = {
2050 poolId: poolId,
2051 definitionId: definitionId
2052 };
2053 try {
2054 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues);
2055 let url = verData.requestUrl;
2056 let options = this.createRequestOptions('application/json', verData.apiVersion);
2057 let res;
2058 res = yield this.rest.get(url, options);
2059 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, false);
2060 resolve(ret);
2061 }
2062 catch (err) {
2063 reject(err);
2064 }
2065 }));
2066 });
2067 }
2068 /**
2069 * @param {number} poolId
2070 */
2071 getAgentPoolMaintenanceDefinitions(poolId) {
2072 return __awaiter(this, void 0, void 0, function* () {
2073 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2074 let routeValues = {
2075 poolId: poolId
2076 };
2077 try {
2078 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues);
2079 let url = verData.requestUrl;
2080 let options = this.createRequestOptions('application/json', verData.apiVersion);
2081 let res;
2082 res = yield this.rest.get(url, options);
2083 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, true);
2084 resolve(ret);
2085 }
2086 catch (err) {
2087 reject(err);
2088 }
2089 }));
2090 });
2091 }
2092 /**
2093 * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceDefinition} definition
2094 * @param {number} poolId
2095 * @param {number} definitionId
2096 */
2097 updateAgentPoolMaintenanceDefinition(definition, poolId, definitionId) {
2098 return __awaiter(this, void 0, void 0, function* () {
2099 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2100 let routeValues = {
2101 poolId: poolId,
2102 definitionId: definitionId
2103 };
2104 try {
2105 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues);
2106 let url = verData.requestUrl;
2107 let options = this.createRequestOptions('application/json', verData.apiVersion);
2108 let res;
2109 res = yield this.rest.replace(url, definition, options);
2110 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, false);
2111 resolve(ret);
2112 }
2113 catch (err) {
2114 reject(err);
2115 }
2116 }));
2117 });
2118 }
2119 /**
2120 * @param {number} poolId
2121 * @param {number} jobId
2122 */
2123 deleteAgentPoolMaintenanceJob(poolId, jobId) {
2124 return __awaiter(this, void 0, void 0, function* () {
2125 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2126 let routeValues = {
2127 poolId: poolId,
2128 jobId: jobId
2129 };
2130 try {
2131 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues);
2132 let url = verData.requestUrl;
2133 let options = this.createRequestOptions('application/json', verData.apiVersion);
2134 let res;
2135 res = yield this.rest.del(url, options);
2136 let ret = this.formatResponse(res.result, null, false);
2137 resolve(ret);
2138 }
2139 catch (err) {
2140 reject(err);
2141 }
2142 }));
2143 });
2144 }
2145 /**
2146 * @param {number} poolId
2147 * @param {number} jobId
2148 */
2149 getAgentPoolMaintenanceJob(poolId, jobId) {
2150 return __awaiter(this, void 0, void 0, function* () {
2151 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2152 let routeValues = {
2153 poolId: poolId,
2154 jobId: jobId
2155 };
2156 try {
2157 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues);
2158 let url = verData.requestUrl;
2159 let options = this.createRequestOptions('application/json', verData.apiVersion);
2160 let res;
2161 res = yield this.rest.get(url, options);
2162 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, false);
2163 resolve(ret);
2164 }
2165 catch (err) {
2166 reject(err);
2167 }
2168 }));
2169 });
2170 }
2171 /**
2172 * @param {number} poolId
2173 * @param {number} jobId
2174 */
2175 getAgentPoolMaintenanceJobLogs(poolId, jobId) {
2176 return __awaiter(this, void 0, void 0, function* () {
2177 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2178 let routeValues = {
2179 poolId: poolId,
2180 jobId: jobId
2181 };
2182 try {
2183 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues);
2184 let url = verData.requestUrl;
2185 let apiVersion = verData.apiVersion;
2186 let accept = this.createAcceptHeader("application/zip", apiVersion);
2187 resolve((yield this.http.get(url, { "Accept": accept })).message);
2188 }
2189 catch (err) {
2190 reject(err);
2191 }
2192 }));
2193 });
2194 }
2195 /**
2196 * @param {number} poolId
2197 * @param {number} definitionId
2198 */
2199 getAgentPoolMaintenanceJobs(poolId, definitionId) {
2200 return __awaiter(this, void 0, void 0, function* () {
2201 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2202 let routeValues = {
2203 poolId: poolId
2204 };
2205 let queryValues = {
2206 definitionId: definitionId,
2207 };
2208 try {
2209 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues, queryValues);
2210 let url = verData.requestUrl;
2211 let options = this.createRequestOptions('application/json', verData.apiVersion);
2212 let res;
2213 res = yield this.rest.get(url, options);
2214 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, true);
2215 resolve(ret);
2216 }
2217 catch (err) {
2218 reject(err);
2219 }
2220 }));
2221 });
2222 }
2223 /**
2224 * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceJob} job
2225 * @param {number} poolId
2226 */
2227 queueAgentPoolMaintenanceJob(job, poolId) {
2228 return __awaiter(this, void 0, void 0, function* () {
2229 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2230 let routeValues = {
2231 poolId: poolId
2232 };
2233 try {
2234 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues);
2235 let url = verData.requestUrl;
2236 let options = this.createRequestOptions('application/json', verData.apiVersion);
2237 let res;
2238 res = yield this.rest.create(url, job, options);
2239 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, false);
2240 resolve(ret);
2241 }
2242 catch (err) {
2243 reject(err);
2244 }
2245 }));
2246 });
2247 }
2248 /**
2249 * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceJob} job
2250 * @param {number} poolId
2251 * @param {number} jobId
2252 */
2253 updateAgentPoolMaintenanceJob(job, poolId, jobId) {
2254 return __awaiter(this, void 0, void 0, function* () {
2255 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2256 let routeValues = {
2257 poolId: poolId,
2258 jobId: jobId
2259 };
2260 try {
2261 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues);
2262 let url = verData.requestUrl;
2263 let options = this.createRequestOptions('application/json', verData.apiVersion);
2264 let res;
2265 res = yield this.rest.update(url, job, options);
2266 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, false);
2267 resolve(ret);
2268 }
2269 catch (err) {
2270 reject(err);
2271 }
2272 }));
2273 });
2274 }
2275 /**
2276 * @param {number} poolId
2277 * @param {number} messageId
2278 * @param {string} sessionId
2279 */
2280 deleteMessage(poolId, messageId, sessionId) {
2281 return __awaiter(this, void 0, void 0, function* () {
2282 if (sessionId == null) {
2283 throw new TypeError('sessionId can not be null or undefined');
2284 }
2285 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2286 let routeValues = {
2287 poolId: poolId,
2288 messageId: messageId
2289 };
2290 let queryValues = {
2291 sessionId: sessionId,
2292 };
2293 try {
2294 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues);
2295 let url = verData.requestUrl;
2296 let options = this.createRequestOptions('application/json', verData.apiVersion);
2297 let res;
2298 res = yield this.rest.del(url, options);
2299 let ret = this.formatResponse(res.result, null, false);
2300 resolve(ret);
2301 }
2302 catch (err) {
2303 reject(err);
2304 }
2305 }));
2306 });
2307 }
2308 /**
2309 * @param {number} poolId
2310 * @param {string} sessionId
2311 * @param {number} lastMessageId
2312 */
2313 getMessage(poolId, sessionId, lastMessageId) {
2314 return __awaiter(this, void 0, void 0, function* () {
2315 if (sessionId == null) {
2316 throw new TypeError('sessionId can not be null or undefined');
2317 }
2318 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2319 let routeValues = {
2320 poolId: poolId
2321 };
2322 let queryValues = {
2323 sessionId: sessionId,
2324 lastMessageId: lastMessageId,
2325 };
2326 try {
2327 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues);
2328 let url = verData.requestUrl;
2329 let options = this.createRequestOptions('application/json', verData.apiVersion);
2330 let res;
2331 res = yield this.rest.get(url, options);
2332 let ret = this.formatResponse(res.result, null, false);
2333 resolve(ret);
2334 }
2335 catch (err) {
2336 reject(err);
2337 }
2338 }));
2339 });
2340 }
2341 /**
2342 * @param {number} poolId
2343 * @param {number} agentId
2344 */
2345 refreshAgent(poolId, agentId) {
2346 return __awaiter(this, void 0, void 0, function* () {
2347 if (agentId == null) {
2348 throw new TypeError('agentId can not be null or undefined');
2349 }
2350 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2351 let routeValues = {
2352 poolId: poolId
2353 };
2354 let queryValues = {
2355 agentId: agentId,
2356 };
2357 try {
2358 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues);
2359 let url = verData.requestUrl;
2360 let options = this.createRequestOptions('application/json', verData.apiVersion);
2361 let res;
2362 res = yield this.rest.create(url, null, options);
2363 let ret = this.formatResponse(res.result, null, false);
2364 resolve(ret);
2365 }
2366 catch (err) {
2367 reject(err);
2368 }
2369 }));
2370 });
2371 }
2372 /**
2373 * @param {number} poolId
2374 */
2375 refreshAgents(poolId) {
2376 return __awaiter(this, void 0, void 0, function* () {
2377 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2378 let routeValues = {
2379 poolId: poolId
2380 };
2381 try {
2382 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues);
2383 let url = verData.requestUrl;
2384 let options = this.createRequestOptions('application/json', verData.apiVersion);
2385 let res;
2386 res = yield this.rest.create(url, null, options);
2387 let ret = this.formatResponse(res.result, null, false);
2388 resolve(ret);
2389 }
2390 catch (err) {
2391 reject(err);
2392 }
2393 }));
2394 });
2395 }
2396 /**
2397 * @param {TaskAgentInterfaces.TaskAgentMessage} message
2398 * @param {number} poolId
2399 * @param {number} requestId
2400 */
2401 sendMessage(message, poolId, requestId) {
2402 return __awaiter(this, void 0, void 0, function* () {
2403 if (requestId == null) {
2404 throw new TypeError('requestId can not be null or undefined');
2405 }
2406 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2407 let routeValues = {
2408 poolId: poolId
2409 };
2410 let queryValues = {
2411 requestId: requestId,
2412 };
2413 try {
2414 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues);
2415 let url = verData.requestUrl;
2416 let options = this.createRequestOptions('application/json', verData.apiVersion);
2417 let res;
2418 res = yield this.rest.create(url, message, options);
2419 let ret = this.formatResponse(res.result, null, false);
2420 resolve(ret);
2421 }
2422 catch (err) {
2423 reject(err);
2424 }
2425 }));
2426 });
2427 }
2428 /**
2429 * @param {string} packageType
2430 * @param {string} platform
2431 * @param {string} version
2432 */
2433 getPackage(packageType, platform, version) {
2434 return __awaiter(this, void 0, void 0, function* () {
2435 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2436 let routeValues = {
2437 packageType: packageType,
2438 platform: platform,
2439 version: version
2440 };
2441 try {
2442 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "8ffcd551-079c-493a-9c02-54346299d144", routeValues);
2443 let url = verData.requestUrl;
2444 let options = this.createRequestOptions('application/json', verData.apiVersion);
2445 let res;
2446 res = yield this.rest.get(url, options);
2447 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.PackageMetadata, false);
2448 resolve(ret);
2449 }
2450 catch (err) {
2451 reject(err);
2452 }
2453 }));
2454 });
2455 }
2456 /**
2457 * @param {string} packageType
2458 * @param {string} platform
2459 * @param {number} top
2460 */
2461 getPackages(packageType, platform, top) {
2462 return __awaiter(this, void 0, void 0, function* () {
2463 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2464 let routeValues = {
2465 packageType: packageType,
2466 platform: platform
2467 };
2468 let queryValues = {
2469 '$top': top,
2470 };
2471 try {
2472 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "8ffcd551-079c-493a-9c02-54346299d144", routeValues, queryValues);
2473 let url = verData.requestUrl;
2474 let options = this.createRequestOptions('application/json', verData.apiVersion);
2475 let res;
2476 res = yield this.rest.get(url, options);
2477 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.PackageMetadata, true);
2478 resolve(ret);
2479 }
2480 catch (err) {
2481 reject(err);
2482 }
2483 }));
2484 });
2485 }
2486 /**
2487 * @param {number} poolId
2488 */
2489 getAgentPoolMetadata(poolId) {
2490 return __awaiter(this, void 0, void 0, function* () {
2491 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2492 let routeValues = {
2493 poolId: poolId
2494 };
2495 try {
2496 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0d62f887-9f53-48b9-9161-4c35d5735b0f", routeValues);
2497 let url = verData.requestUrl;
2498 let apiVersion = verData.apiVersion;
2499 let accept = this.createAcceptHeader("text/plain", apiVersion);
2500 resolve((yield this.http.get(url, { "Accept": accept })).message);
2501 }
2502 catch (err) {
2503 reject(err);
2504 }
2505 }));
2506 });
2507 }
2508 /**
2509 * @param {any} agentPoolMetadata
2510 * @param {number} poolId
2511 */
2512 setAgentPoolMetadata(customHeaders, agentPoolMetadata, poolId) {
2513 return __awaiter(this, void 0, void 0, function* () {
2514 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2515 let routeValues = {
2516 poolId: poolId
2517 };
2518 customHeaders = customHeaders || {};
2519 customHeaders["Content-Type"] = "application/octet-stream";
2520 try {
2521 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0d62f887-9f53-48b9-9161-4c35d5735b0f", routeValues);
2522 let url = verData.requestUrl;
2523 let options = this.createRequestOptions('application/json', verData.apiVersion);
2524 options.additionalHeaders = customHeaders;
2525 let res;
2526 res = yield this.rest.replace(url, agentPoolMetadata, options);
2527 let ret = this.formatResponse(res.result, null, false);
2528 resolve(ret);
2529 }
2530 catch (err) {
2531 reject(err);
2532 }
2533 }));
2534 });
2535 }
2536 /**
2537 * Checks if current identity has passed permissions on a pool.
2538 *
2539 * @param {number} poolId - Id of the pool to check
2540 * @param {number} permissions - Permissions to check. Multiple permissions might be merged into single value using bitwise OR operator (e.g. AgentPoolPermissions.Manage | AgentPoolPermissions.View)
2541 */
2542 hasPoolPermissions(poolId, permissions) {
2543 return __awaiter(this, void 0, void 0, function* () {
2544 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2545 let routeValues = {
2546 poolId: poolId,
2547 permissions: permissions
2548 };
2549 try {
2550 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "162778f3-4b48-48f3-9d58-436fb9c407bc", routeValues);
2551 let url = verData.requestUrl;
2552 let options = this.createRequestOptions('application/json', verData.apiVersion);
2553 let res;
2554 res = yield this.rest.get(url, options);
2555 let ret = this.formatResponse(res.result, null, false);
2556 resolve(ret);
2557 }
2558 catch (err) {
2559 reject(err);
2560 }
2561 }));
2562 });
2563 }
2564 /**
2565 * Create an agent pool.
2566 *
2567 * @param {TaskAgentInterfaces.TaskAgentPool} pool - Details about the new agent pool
2568 */
2569 addAgentPool(pool) {
2570 return __awaiter(this, void 0, void 0, function* () {
2571 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2572 let routeValues = {};
2573 try {
2574 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues);
2575 let url = verData.requestUrl;
2576 let options = this.createRequestOptions('application/json', verData.apiVersion);
2577 let res;
2578 res = yield this.rest.create(url, pool, options);
2579 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, false);
2580 resolve(ret);
2581 }
2582 catch (err) {
2583 reject(err);
2584 }
2585 }));
2586 });
2587 }
2588 /**
2589 * Delete an agent pool.
2590 *
2591 * @param {number} poolId - ID of the agent pool to delete
2592 */
2593 deleteAgentPool(poolId) {
2594 return __awaiter(this, void 0, void 0, function* () {
2595 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2596 let routeValues = {
2597 poolId: poolId
2598 };
2599 try {
2600 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues);
2601 let url = verData.requestUrl;
2602 let options = this.createRequestOptions('application/json', verData.apiVersion);
2603 let res;
2604 res = yield this.rest.del(url, options);
2605 let ret = this.formatResponse(res.result, null, false);
2606 resolve(ret);
2607 }
2608 catch (err) {
2609 reject(err);
2610 }
2611 }));
2612 });
2613 }
2614 /**
2615 * Get information about an agent pool.
2616 *
2617 * @param {number} poolId - An agent pool ID
2618 * @param {string[]} properties - Agent pool properties (comma-separated)
2619 * @param {TaskAgentInterfaces.TaskAgentPoolActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2620 */
2621 getAgentPool(poolId, properties, actionFilter) {
2622 return __awaiter(this, void 0, void 0, function* () {
2623 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2624 let routeValues = {
2625 poolId: poolId
2626 };
2627 let queryValues = {
2628 properties: properties && properties.join(","),
2629 actionFilter: actionFilter,
2630 };
2631 try {
2632 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues, queryValues);
2633 let url = verData.requestUrl;
2634 let options = this.createRequestOptions('application/json', verData.apiVersion);
2635 let res;
2636 res = yield this.rest.get(url, options);
2637 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, false);
2638 resolve(ret);
2639 }
2640 catch (err) {
2641 reject(err);
2642 }
2643 }));
2644 });
2645 }
2646 /**
2647 * Get a list of agent pools.
2648 *
2649 * @param {string} poolName - Filter by name
2650 * @param {string[]} properties - Filter by agent pool properties (comma-separated)
2651 * @param {TaskAgentInterfaces.TaskAgentPoolType} poolType - Filter by pool type
2652 * @param {TaskAgentInterfaces.TaskAgentPoolActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2653 */
2654 getAgentPools(poolName, properties, poolType, actionFilter) {
2655 return __awaiter(this, void 0, void 0, function* () {
2656 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2657 let routeValues = {};
2658 let queryValues = {
2659 poolName: poolName,
2660 properties: properties && properties.join(","),
2661 poolType: poolType,
2662 actionFilter: actionFilter,
2663 };
2664 try {
2665 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues, queryValues);
2666 let url = verData.requestUrl;
2667 let options = this.createRequestOptions('application/json', verData.apiVersion);
2668 let res;
2669 res = yield this.rest.get(url, options);
2670 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, true);
2671 resolve(ret);
2672 }
2673 catch (err) {
2674 reject(err);
2675 }
2676 }));
2677 });
2678 }
2679 /**
2680 * Get a list of agent pools.
2681 *
2682 * @param {number[]} poolIds - pool Ids to fetch
2683 * @param {TaskAgentInterfaces.TaskAgentPoolActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2684 */
2685 getAgentPoolsByIds(poolIds, actionFilter) {
2686 return __awaiter(this, void 0, void 0, function* () {
2687 if (poolIds == null) {
2688 throw new TypeError('poolIds can not be null or undefined');
2689 }
2690 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2691 let routeValues = {};
2692 let queryValues = {
2693 poolIds: poolIds && poolIds.join(","),
2694 actionFilter: actionFilter,
2695 };
2696 try {
2697 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues, queryValues);
2698 let url = verData.requestUrl;
2699 let options = this.createRequestOptions('application/json', verData.apiVersion);
2700 let res;
2701 res = yield this.rest.get(url, options);
2702 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, true);
2703 resolve(ret);
2704 }
2705 catch (err) {
2706 reject(err);
2707 }
2708 }));
2709 });
2710 }
2711 /**
2712 * Update properties on an agent pool
2713 *
2714 * @param {TaskAgentInterfaces.TaskAgentPool} pool - Updated agent pool details
2715 * @param {number} poolId - The agent pool to update
2716 */
2717 updateAgentPool(pool, poolId) {
2718 return __awaiter(this, void 0, void 0, function* () {
2719 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2720 let routeValues = {
2721 poolId: poolId
2722 };
2723 try {
2724 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues);
2725 let url = verData.requestUrl;
2726 let options = this.createRequestOptions('application/json', verData.apiVersion);
2727 let res;
2728 res = yield this.rest.update(url, pool, options);
2729 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, false);
2730 resolve(ret);
2731 }
2732 catch (err) {
2733 reject(err);
2734 }
2735 }));
2736 });
2737 }
2738 /**
2739 * Create a new agent queue to connect a project to an agent pool.
2740 *
2741 * @param {TaskAgentInterfaces.TaskAgentQueue} queue - Details about the queue to create
2742 * @param {string} project - Project ID or project name
2743 * @param {boolean} authorizePipelines - Automatically authorize this queue when using YAML
2744 */
2745 addAgentQueue(queue, project, authorizePipelines) {
2746 return __awaiter(this, void 0, void 0, function* () {
2747 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2748 let routeValues = {
2749 project: project
2750 };
2751 let queryValues = {
2752 authorizePipelines: authorizePipelines,
2753 };
2754 try {
2755 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues);
2756 let url = verData.requestUrl;
2757 let options = this.createRequestOptions('application/json', verData.apiVersion);
2758 let res;
2759 res = yield this.rest.create(url, queue, options);
2760 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, false);
2761 resolve(ret);
2762 }
2763 catch (err) {
2764 reject(err);
2765 }
2766 }));
2767 });
2768 }
2769 /**
2770 * Create a new team project.
2771 *
2772 * @param {string} project - Project ID or project name
2773 */
2774 createTeamProject(project) {
2775 return __awaiter(this, void 0, void 0, function* () {
2776 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2777 let routeValues = {
2778 project: project
2779 };
2780 try {
2781 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues);
2782 let url = verData.requestUrl;
2783 let options = this.createRequestOptions('application/json', verData.apiVersion);
2784 let res;
2785 res = yield this.rest.replace(url, null, options);
2786 let ret = this.formatResponse(res.result, null, false);
2787 resolve(ret);
2788 }
2789 catch (err) {
2790 reject(err);
2791 }
2792 }));
2793 });
2794 }
2795 /**
2796 * Removes an agent queue from a project.
2797 *
2798 * @param {number} queueId - The agent queue to remove
2799 * @param {string} project - Project ID or project name
2800 */
2801 deleteAgentQueue(queueId, project) {
2802 return __awaiter(this, void 0, void 0, function* () {
2803 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2804 let routeValues = {
2805 project: project,
2806 queueId: queueId
2807 };
2808 try {
2809 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues);
2810 let url = verData.requestUrl;
2811 let options = this.createRequestOptions('application/json', verData.apiVersion);
2812 let res;
2813 res = yield this.rest.del(url, options);
2814 let ret = this.formatResponse(res.result, null, false);
2815 resolve(ret);
2816 }
2817 catch (err) {
2818 reject(err);
2819 }
2820 }));
2821 });
2822 }
2823 /**
2824 * Get information about an agent queue.
2825 *
2826 * @param {number} queueId - The agent queue to get information about
2827 * @param {string} project - Project ID or project name
2828 * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2829 */
2830 getAgentQueue(queueId, project, actionFilter) {
2831 return __awaiter(this, void 0, void 0, function* () {
2832 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2833 let routeValues = {
2834 project: project,
2835 queueId: queueId
2836 };
2837 let queryValues = {
2838 actionFilter: actionFilter,
2839 };
2840 try {
2841 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues);
2842 let url = verData.requestUrl;
2843 let options = this.createRequestOptions('application/json', verData.apiVersion);
2844 let res;
2845 res = yield this.rest.get(url, options);
2846 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, false);
2847 resolve(ret);
2848 }
2849 catch (err) {
2850 reject(err);
2851 }
2852 }));
2853 });
2854 }
2855 /**
2856 * Get a list of agent queues.
2857 *
2858 * @param {string} project - Project ID or project name
2859 * @param {string} queueName - Filter on the agent queue name
2860 * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2861 */
2862 getAgentQueues(project, queueName, actionFilter) {
2863 return __awaiter(this, void 0, void 0, function* () {
2864 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2865 let routeValues = {
2866 project: project
2867 };
2868 let queryValues = {
2869 queueName: queueName,
2870 actionFilter: actionFilter,
2871 };
2872 try {
2873 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues);
2874 let url = verData.requestUrl;
2875 let options = this.createRequestOptions('application/json', verData.apiVersion);
2876 let res;
2877 res = yield this.rest.get(url, options);
2878 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true);
2879 resolve(ret);
2880 }
2881 catch (err) {
2882 reject(err);
2883 }
2884 }));
2885 });
2886 }
2887 /**
2888 * Get a list of agent queues by their IDs
2889 *
2890 * @param {number[]} queueIds - A comma-separated list of agent queue IDs to retrieve
2891 * @param {string} project - Project ID or project name
2892 * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2893 */
2894 getAgentQueuesByIds(queueIds, project, actionFilter) {
2895 return __awaiter(this, void 0, void 0, function* () {
2896 if (queueIds == null) {
2897 throw new TypeError('queueIds can not be null or undefined');
2898 }
2899 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2900 let routeValues = {
2901 project: project
2902 };
2903 let queryValues = {
2904 queueIds: queueIds && queueIds.join(","),
2905 actionFilter: actionFilter,
2906 };
2907 try {
2908 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues);
2909 let url = verData.requestUrl;
2910 let options = this.createRequestOptions('application/json', verData.apiVersion);
2911 let res;
2912 res = yield this.rest.get(url, options);
2913 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true);
2914 resolve(ret);
2915 }
2916 catch (err) {
2917 reject(err);
2918 }
2919 }));
2920 });
2921 }
2922 /**
2923 * Get a list of agent queues by their names
2924 *
2925 * @param {string[]} queueNames - A comma-separated list of agent names to retrieve
2926 * @param {string} project - Project ID or project name
2927 * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2928 */
2929 getAgentQueuesByNames(queueNames, project, actionFilter) {
2930 return __awaiter(this, void 0, void 0, function* () {
2931 if (queueNames == null) {
2932 throw new TypeError('queueNames can not be null or undefined');
2933 }
2934 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2935 let routeValues = {
2936 project: project
2937 };
2938 let queryValues = {
2939 queueNames: queueNames && queueNames.join(","),
2940 actionFilter: actionFilter,
2941 };
2942 try {
2943 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues);
2944 let url = verData.requestUrl;
2945 let options = this.createRequestOptions('application/json', verData.apiVersion);
2946 let res;
2947 res = yield this.rest.get(url, options);
2948 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true);
2949 resolve(ret);
2950 }
2951 catch (err) {
2952 reject(err);
2953 }
2954 }));
2955 });
2956 }
2957 /**
2958 * Get a list of agent queues by pool ids
2959 *
2960 * @param {number[]} poolIds - A comma-separated list of pool ids to get the corresponding queues for
2961 * @param {string} project - Project ID or project name
2962 * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions
2963 */
2964 getAgentQueuesForPools(poolIds, project, actionFilter) {
2965 return __awaiter(this, void 0, void 0, function* () {
2966 if (poolIds == null) {
2967 throw new TypeError('poolIds can not be null or undefined');
2968 }
2969 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2970 let routeValues = {
2971 project: project
2972 };
2973 let queryValues = {
2974 poolIds: poolIds && poolIds.join(","),
2975 actionFilter: actionFilter,
2976 };
2977 try {
2978 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues);
2979 let url = verData.requestUrl;
2980 let options = this.createRequestOptions('application/json', verData.apiVersion);
2981 let res;
2982 res = yield this.rest.get(url, options);
2983 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true);
2984 resolve(ret);
2985 }
2986 catch (err) {
2987 reject(err);
2988 }
2989 }));
2990 });
2991 }
2992 /**
2993 * @param {number} agentCloudId
2994 */
2995 getAgentCloudRequests(agentCloudId) {
2996 return __awaiter(this, void 0, void 0, function* () {
2997 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2998 let routeValues = {
2999 agentCloudId: agentCloudId
3000 };
3001 try {
3002 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "20189bd7-5134-49c2-b8e9-f9e856eea2b2", routeValues);
3003 let url = verData.requestUrl;
3004 let options = this.createRequestOptions('application/json', verData.apiVersion);
3005 let res;
3006 res = yield this.rest.get(url, options);
3007 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentCloudRequest, true);
3008 resolve(ret);
3009 }
3010 catch (err) {
3011 reject(err);
3012 }
3013 }));
3014 });
3015 }
3016 /**
3017 */
3018 getResourceLimits() {
3019 return __awaiter(this, void 0, void 0, function* () {
3020 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3021 let routeValues = {};
3022 try {
3023 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "1f1f0557-c445-42a6-b4a0-0df605a3a0f8", routeValues);
3024 let url = verData.requestUrl;
3025 let options = this.createRequestOptions('application/json', verData.apiVersion);
3026 let res;
3027 res = yield this.rest.get(url, options);
3028 let ret = this.formatResponse(res.result, null, true);
3029 resolve(ret);
3030 }
3031 catch (err) {
3032 reject(err);
3033 }
3034 }));
3035 });
3036 }
3037 /**
3038 * @param {string} parallelismTag
3039 * @param {boolean} poolIsHosted
3040 * @param {boolean} includeRunningRequests
3041 */
3042 getResourceUsage(parallelismTag, poolIsHosted, includeRunningRequests) {
3043 return __awaiter(this, void 0, void 0, function* () {
3044 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3045 let routeValues = {};
3046 let queryValues = {
3047 parallelismTag: parallelismTag,
3048 poolIsHosted: poolIsHosted,
3049 includeRunningRequests: includeRunningRequests,
3050 };
3051 try {
3052 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "eae1d376-a8b1-4475-9041-1dfdbe8f0143", routeValues, queryValues);
3053 let url = verData.requestUrl;
3054 let options = this.createRequestOptions('application/json', verData.apiVersion);
3055 let res;
3056 res = yield this.rest.get(url, options);
3057 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.ResourceUsage, false);
3058 resolve(ret);
3059 }
3060 catch (err) {
3061 reject(err);
3062 }
3063 }));
3064 });
3065 }
3066 /**
3067 * @param {string} project - Project ID or project name
3068 * @param {string} taskGroupId
3069 */
3070 getTaskGroupHistory(project, taskGroupId) {
3071 return __awaiter(this, void 0, void 0, function* () {
3072 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3073 let routeValues = {
3074 project: project,
3075 taskGroupId: taskGroupId
3076 };
3077 try {
3078 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "100cc92a-b255-47fa-9ab3-e44a2985a3ac", routeValues);
3079 let url = verData.requestUrl;
3080 let options = this.createRequestOptions('application/json', verData.apiVersion);
3081 let res;
3082 res = yield this.rest.get(url, options);
3083 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroupRevision, true);
3084 resolve(ret);
3085 }
3086 catch (err) {
3087 reject(err);
3088 }
3089 }));
3090 });
3091 }
3092 /**
3093 * Delete a secure file
3094 *
3095 * @param {string} project - Project ID or project name
3096 * @param {string} secureFileId - The unique secure file Id
3097 */
3098 deleteSecureFile(project, secureFileId) {
3099 return __awaiter(this, void 0, void 0, function* () {
3100 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3101 let routeValues = {
3102 project: project,
3103 secureFileId: secureFileId
3104 };
3105 try {
3106 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues);
3107 let url = verData.requestUrl;
3108 let options = this.createRequestOptions('application/json', verData.apiVersion);
3109 let res;
3110 res = yield this.rest.del(url, options);
3111 let ret = this.formatResponse(res.result, null, false);
3112 resolve(ret);
3113 }
3114 catch (err) {
3115 reject(err);
3116 }
3117 }));
3118 });
3119 }
3120 /**
3121 * Download a secure file by Id
3122 *
3123 * @param {string} project - Project ID or project name
3124 * @param {string} secureFileId - The unique secure file Id
3125 * @param {string} ticket - A valid download ticket
3126 * @param {boolean} download - If download is true, the file is sent as attachement in the response body. If download is false, the response body contains the file stream.
3127 */
3128 downloadSecureFile(project, secureFileId, ticket, download) {
3129 return __awaiter(this, void 0, void 0, function* () {
3130 if (ticket == null) {
3131 throw new TypeError('ticket can not be null or undefined');
3132 }
3133 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3134 let routeValues = {
3135 project: project,
3136 secureFileId: secureFileId
3137 };
3138 let queryValues = {
3139 ticket: ticket,
3140 download: download,
3141 };
3142 try {
3143 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3144 let url = verData.requestUrl;
3145 let apiVersion = verData.apiVersion;
3146 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
3147 resolve((yield this.http.get(url, { "Accept": accept })).message);
3148 }
3149 catch (err) {
3150 reject(err);
3151 }
3152 }));
3153 });
3154 }
3155 /**
3156 * Get a secure file
3157 *
3158 * @param {string} project - Project ID or project name
3159 * @param {string} secureFileId - The unique secure file Id
3160 * @param {boolean} includeDownloadTicket - If includeDownloadTicket is true and the caller has permissions, a download ticket is included in the response.
3161 * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter
3162 */
3163 getSecureFile(project, secureFileId, includeDownloadTicket, actionFilter) {
3164 return __awaiter(this, void 0, void 0, function* () {
3165 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3166 let routeValues = {
3167 project: project,
3168 secureFileId: secureFileId
3169 };
3170 let queryValues = {
3171 includeDownloadTicket: includeDownloadTicket,
3172 actionFilter: actionFilter,
3173 };
3174 try {
3175 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3176 let url = verData.requestUrl;
3177 let options = this.createRequestOptions('application/json', verData.apiVersion);
3178 let res;
3179 res = yield this.rest.get(url, options);
3180 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, false);
3181 resolve(ret);
3182 }
3183 catch (err) {
3184 reject(err);
3185 }
3186 }));
3187 });
3188 }
3189 /**
3190 * Get secure files
3191 *
3192 * @param {string} project - Project ID or project name
3193 * @param {string} namePattern - Name of the secure file to match. Can include wildcards to match multiple files.
3194 * @param {boolean} includeDownloadTickets - If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.
3195 * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter - Filter by secure file permissions for View, Manage or Use action. Defaults to View.
3196 */
3197 getSecureFiles(project, namePattern, includeDownloadTickets, actionFilter) {
3198 return __awaiter(this, void 0, void 0, function* () {
3199 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3200 let routeValues = {
3201 project: project
3202 };
3203 let queryValues = {
3204 namePattern: namePattern,
3205 includeDownloadTickets: includeDownloadTickets,
3206 actionFilter: actionFilter,
3207 };
3208 try {
3209 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3210 let url = verData.requestUrl;
3211 let options = this.createRequestOptions('application/json', verData.apiVersion);
3212 let res;
3213 res = yield this.rest.get(url, options);
3214 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true);
3215 resolve(ret);
3216 }
3217 catch (err) {
3218 reject(err);
3219 }
3220 }));
3221 });
3222 }
3223 /**
3224 * Get secure files
3225 *
3226 * @param {string} project - Project ID or project name
3227 * @param {string[]} secureFileIds - A list of secure file Ids
3228 * @param {boolean} includeDownloadTickets - If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.
3229 * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter
3230 */
3231 getSecureFilesByIds(project, secureFileIds, includeDownloadTickets, actionFilter) {
3232 return __awaiter(this, void 0, void 0, function* () {
3233 if (secureFileIds == null) {
3234 throw new TypeError('secureFileIds can not be null or undefined');
3235 }
3236 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3237 let routeValues = {
3238 project: project
3239 };
3240 let queryValues = {
3241 secureFileIds: secureFileIds && secureFileIds.join(","),
3242 includeDownloadTickets: includeDownloadTickets,
3243 actionFilter: actionFilter,
3244 };
3245 try {
3246 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3247 let url = verData.requestUrl;
3248 let options = this.createRequestOptions('application/json', verData.apiVersion);
3249 let res;
3250 res = yield this.rest.get(url, options);
3251 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true);
3252 resolve(ret);
3253 }
3254 catch (err) {
3255 reject(err);
3256 }
3257 }));
3258 });
3259 }
3260 /**
3261 * Get secure files
3262 *
3263 * @param {string} project - Project ID or project name
3264 * @param {string[]} secureFileNames - A list of secure file Ids
3265 * @param {boolean} includeDownloadTickets - If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.
3266 * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter
3267 */
3268 getSecureFilesByNames(project, secureFileNames, includeDownloadTickets, actionFilter) {
3269 return __awaiter(this, void 0, void 0, function* () {
3270 if (secureFileNames == null) {
3271 throw new TypeError('secureFileNames can not be null or undefined');
3272 }
3273 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3274 let routeValues = {
3275 project: project
3276 };
3277 let queryValues = {
3278 secureFileNames: secureFileNames && secureFileNames.join(","),
3279 includeDownloadTickets: includeDownloadTickets,
3280 actionFilter: actionFilter,
3281 };
3282 try {
3283 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3284 let url = verData.requestUrl;
3285 let options = this.createRequestOptions('application/json', verData.apiVersion);
3286 let res;
3287 res = yield this.rest.get(url, options);
3288 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true);
3289 resolve(ret);
3290 }
3291 catch (err) {
3292 reject(err);
3293 }
3294 }));
3295 });
3296 }
3297 /**
3298 * Query secure files using a name pattern and a condition on file properties.
3299 *
3300 * @param {string} condition - The main condition syntax is described [here](https://go.microsoft.com/fwlink/?linkid=842996). Use the *property('property-name')* function to access the value of the specified property of a secure file. It returns null if the property is not set. E.g. ``` and( eq( property('devices'), '2' ), in( property('provisioning profile type'), 'ad hoc', 'development' ) ) ```
3301 * @param {string} project - Project ID or project name
3302 * @param {string} namePattern - Name of the secure file to match. Can include wildcards to match multiple files.
3303 */
3304 querySecureFilesByProperties(condition, project, namePattern) {
3305 return __awaiter(this, void 0, void 0, function* () {
3306 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3307 let routeValues = {
3308 project: project
3309 };
3310 let queryValues = {
3311 namePattern: namePattern,
3312 };
3313 try {
3314 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3315 let url = verData.requestUrl;
3316 let options = this.createRequestOptions('application/json', verData.apiVersion);
3317 let res;
3318 res = yield this.rest.create(url, condition, options);
3319 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true);
3320 resolve(ret);
3321 }
3322 catch (err) {
3323 reject(err);
3324 }
3325 }));
3326 });
3327 }
3328 /**
3329 * Update the name or properties of an existing secure file
3330 *
3331 * @param {TaskAgentInterfaces.SecureFile} secureFile - The secure file with updated name and/or properties
3332 * @param {string} project - Project ID or project name
3333 * @param {string} secureFileId - The unique secure file Id
3334 */
3335 updateSecureFile(secureFile, project, secureFileId) {
3336 return __awaiter(this, void 0, void 0, function* () {
3337 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3338 let routeValues = {
3339 project: project,
3340 secureFileId: secureFileId
3341 };
3342 try {
3343 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues);
3344 let url = verData.requestUrl;
3345 let options = this.createRequestOptions('application/json', verData.apiVersion);
3346 let res;
3347 res = yield this.rest.update(url, secureFile, options);
3348 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, false);
3349 resolve(ret);
3350 }
3351 catch (err) {
3352 reject(err);
3353 }
3354 }));
3355 });
3356 }
3357 /**
3358 * Update properties and/or names of a set of secure files. Files are identified by their IDs. Properties provided override the existing one entirely, i.e. do not merge.
3359 *
3360 * @param {TaskAgentInterfaces.SecureFile[]} secureFiles - A list of secure file objects. Only three field must be populated Id, Name, and Properties. The rest of fields in the object are ignored.
3361 * @param {string} project - Project ID or project name
3362 */
3363 updateSecureFiles(secureFiles, project) {
3364 return __awaiter(this, void 0, void 0, function* () {
3365 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3366 let routeValues = {
3367 project: project
3368 };
3369 try {
3370 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues);
3371 let url = verData.requestUrl;
3372 let options = this.createRequestOptions('application/json', verData.apiVersion);
3373 let res;
3374 res = yield this.rest.update(url, secureFiles, options);
3375 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true);
3376 resolve(ret);
3377 }
3378 catch (err) {
3379 reject(err);
3380 }
3381 }));
3382 });
3383 }
3384 /**
3385 * Upload a secure file, include the file stream in the request body
3386 *
3387 * @param {NodeJS.ReadableStream} contentStream - Content to upload
3388 * @param {string} project - Project ID or project name
3389 * @param {string} name - Name of the file to upload
3390 * @param {boolean} authorizePipelines - If authorizePipelines is true, then the secure file is authorized for use by all pipelines in the project.
3391 */
3392 uploadSecureFile(customHeaders, contentStream, project, name, authorizePipelines) {
3393 return __awaiter(this, void 0, void 0, function* () {
3394 if (name == null) {
3395 throw new TypeError('name can not be null or undefined');
3396 }
3397 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3398 let routeValues = {
3399 project: project
3400 };
3401 let queryValues = {
3402 name: name,
3403 authorizePipelines: authorizePipelines,
3404 };
3405 customHeaders = customHeaders || {};
3406 customHeaders["Content-Type"] = "application/octet-stream";
3407 try {
3408 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues);
3409 let url = verData.requestUrl;
3410 let options = this.createRequestOptions('application/json', verData.apiVersion);
3411 options.additionalHeaders = customHeaders;
3412 let res;
3413 res = yield this.rest.uploadStream("POST", url, contentStream, options);
3414 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, false);
3415 resolve(ret);
3416 }
3417 catch (err) {
3418 reject(err);
3419 }
3420 }));
3421 });
3422 }
3423 /**
3424 * @param {TaskAgentInterfaces.TaskAgentSession} session
3425 * @param {number} poolId
3426 */
3427 createAgentSession(session, poolId) {
3428 return __awaiter(this, void 0, void 0, function* () {
3429 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3430 let routeValues = {
3431 poolId: poolId
3432 };
3433 try {
3434 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "134e239e-2df3-4794-a6f6-24f1f19ec8dc", routeValues);
3435 let url = verData.requestUrl;
3436 let options = this.createRequestOptions('application/json', verData.apiVersion);
3437 let res;
3438 res = yield this.rest.create(url, session, options);
3439 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentSession, false);
3440 resolve(ret);
3441 }
3442 catch (err) {
3443 reject(err);
3444 }
3445 }));
3446 });
3447 }
3448 /**
3449 * @param {number} poolId
3450 * @param {string} sessionId
3451 */
3452 deleteAgentSession(poolId, sessionId) {
3453 return __awaiter(this, void 0, void 0, function* () {
3454 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3455 let routeValues = {
3456 poolId: poolId,
3457 sessionId: sessionId
3458 };
3459 try {
3460 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "134e239e-2df3-4794-a6f6-24f1f19ec8dc", routeValues);
3461 let url = verData.requestUrl;
3462 let options = this.createRequestOptions('application/json', verData.apiVersion);
3463 let res;
3464 res = yield this.rest.del(url, options);
3465 let ret = this.formatResponse(res.result, null, false);
3466 resolve(ret);
3467 }
3468 catch (err) {
3469 reject(err);
3470 }
3471 }));
3472 });
3473 }
3474 /**
3475 * Register a deployment target to a deployment group. Generally this is called by agent configuration tool.
3476 *
3477 * @param {TaskAgentInterfaces.DeploymentMachine} machine - Deployment target to register.
3478 * @param {string} project - Project ID or project name
3479 * @param {number} deploymentGroupId - ID of the deployment group to which the deployment target is registered.
3480 */
3481 addDeploymentTarget(machine, project, deploymentGroupId) {
3482 return __awaiter(this, void 0, void 0, function* () {
3483 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3484 let routeValues = {
3485 project: project,
3486 deploymentGroupId: deploymentGroupId
3487 };
3488 try {
3489 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues);
3490 let url = verData.requestUrl;
3491 let options = this.createRequestOptions('application/json', verData.apiVersion);
3492 let res;
3493 res = yield this.rest.create(url, machine, options);
3494 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
3495 resolve(ret);
3496 }
3497 catch (err) {
3498 reject(err);
3499 }
3500 }));
3501 });
3502 }
3503 /**
3504 * Delete a deployment target in a deployment group. This deletes the agent from associated deployment pool too.
3505 *
3506 * @param {string} project - Project ID or project name
3507 * @param {number} deploymentGroupId - ID of the deployment group in which deployment target is deleted.
3508 * @param {number} targetId - ID of the deployment target to delete.
3509 */
3510 deleteDeploymentTarget(project, deploymentGroupId, targetId) {
3511 return __awaiter(this, void 0, void 0, function* () {
3512 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3513 let routeValues = {
3514 project: project,
3515 deploymentGroupId: deploymentGroupId,
3516 targetId: targetId
3517 };
3518 try {
3519 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues);
3520 let url = verData.requestUrl;
3521 let options = this.createRequestOptions('application/json', verData.apiVersion);
3522 let res;
3523 res = yield this.rest.del(url, options);
3524 let ret = this.formatResponse(res.result, null, false);
3525 resolve(ret);
3526 }
3527 catch (err) {
3528 reject(err);
3529 }
3530 }));
3531 });
3532 }
3533 /**
3534 * Get a deployment target by its ID in a deployment group
3535 *
3536 * @param {string} project - Project ID or project name
3537 * @param {number} deploymentGroupId - ID of the deployment group to which deployment target belongs.
3538 * @param {number} targetId - ID of the deployment target to return.
3539 * @param {TaskAgentInterfaces.DeploymentTargetExpands} expand - Include these additional details in the returned objects.
3540 */
3541 getDeploymentTarget(project, deploymentGroupId, targetId, expand) {
3542 return __awaiter(this, void 0, void 0, function* () {
3543 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3544 let routeValues = {
3545 project: project,
3546 deploymentGroupId: deploymentGroupId,
3547 targetId: targetId
3548 };
3549 let queryValues = {
3550 '$expand': expand,
3551 };
3552 try {
3553 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues, queryValues);
3554 let url = verData.requestUrl;
3555 let options = this.createRequestOptions('application/json', verData.apiVersion);
3556 let res;
3557 res = yield this.rest.get(url, options);
3558 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
3559 resolve(ret);
3560 }
3561 catch (err) {
3562 reject(err);
3563 }
3564 }));
3565 });
3566 }
3567 /**
3568 * Get a list of deployment targets in a deployment group.
3569 *
3570 * @param {string} project - Project ID or project name
3571 * @param {number} deploymentGroupId - ID of the deployment group.
3572 * @param {string[]} tags - Get only the deployment targets that contain all these comma separted list of tags.
3573 * @param {string} name - Name pattern of the deployment targets to return.
3574 * @param {boolean} partialNameMatch - When set to true, treats **name** as pattern. Else treats it as absolute match. Default is **false**.
3575 * @param {TaskAgentInterfaces.DeploymentTargetExpands} expand - Include these additional details in the returned objects.
3576 * @param {TaskAgentInterfaces.TaskAgentStatusFilter} agentStatus - Get only deployment targets that have this status.
3577 * @param {TaskAgentInterfaces.TaskAgentJobResultFilter} agentJobResult - Get only deployment targets that have this last job result.
3578 * @param {string} continuationToken - Get deployment targets with names greater than this continuationToken lexicographically.
3579 * @param {number} top - Maximum number of deployment targets to return. Default is **1000**.
3580 * @param {boolean} enabled - Get only deployment targets that are enabled or disabled. Default is 'null' which returns all the targets.
3581 * @param {string[]} propertyFilters
3582 */
3583 getDeploymentTargets(project, deploymentGroupId, tags, name, partialNameMatch, expand, agentStatus, agentJobResult, continuationToken, top, enabled, propertyFilters) {
3584 return __awaiter(this, void 0, void 0, function* () {
3585 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3586 let routeValues = {
3587 project: project,
3588 deploymentGroupId: deploymentGroupId
3589 };
3590 let queryValues = {
3591 tags: tags && tags.join(","),
3592 name: name,
3593 partialNameMatch: partialNameMatch,
3594 '$expand': expand,
3595 agentStatus: agentStatus,
3596 agentJobResult: agentJobResult,
3597 continuationToken: continuationToken,
3598 '$top': top,
3599 enabled: enabled,
3600 propertyFilters: propertyFilters && propertyFilters.join(","),
3601 };
3602 try {
3603 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues, queryValues);
3604 let url = verData.requestUrl;
3605 let options = this.createRequestOptions('application/json', verData.apiVersion);
3606 let res;
3607 res = yield this.rest.get(url, options);
3608 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true);
3609 resolve(ret);
3610 }
3611 catch (err) {
3612 reject(err);
3613 }
3614 }));
3615 });
3616 }
3617 /**
3618 * Replace a deployment target in a deployment group. Generally this is called by agent configuration tool.
3619 *
3620 * @param {TaskAgentInterfaces.DeploymentMachine} machine - New deployment target.
3621 * @param {string} project - Project ID or project name
3622 * @param {number} deploymentGroupId - ID of the deployment group in which deployment target is replaced.
3623 * @param {number} targetId - ID of the deployment target to replace.
3624 */
3625 replaceDeploymentTarget(machine, project, deploymentGroupId, targetId) {
3626 return __awaiter(this, void 0, void 0, function* () {
3627 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3628 let routeValues = {
3629 project: project,
3630 deploymentGroupId: deploymentGroupId,
3631 targetId: targetId
3632 };
3633 try {
3634 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues);
3635 let url = verData.requestUrl;
3636 let options = this.createRequestOptions('application/json', verData.apiVersion);
3637 let res;
3638 res = yield this.rest.replace(url, machine, options);
3639 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
3640 resolve(ret);
3641 }
3642 catch (err) {
3643 reject(err);
3644 }
3645 }));
3646 });
3647 }
3648 /**
3649 * Update a deployment target and its agent properties in a deployment group. Generally this is called by agent configuration tool.
3650 *
3651 * @param {TaskAgentInterfaces.DeploymentMachine} machine - Deployment target to update.
3652 * @param {string} project - Project ID or project name
3653 * @param {number} deploymentGroupId - ID of the deployment group in which deployment target is updated.
3654 * @param {number} targetId - ID of the deployment target to update.
3655 */
3656 updateDeploymentTarget(machine, project, deploymentGroupId, targetId) {
3657 return __awaiter(this, void 0, void 0, function* () {
3658 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3659 let routeValues = {
3660 project: project,
3661 deploymentGroupId: deploymentGroupId,
3662 targetId: targetId
3663 };
3664 try {
3665 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues);
3666 let url = verData.requestUrl;
3667 let options = this.createRequestOptions('application/json', verData.apiVersion);
3668 let res;
3669 res = yield this.rest.update(url, machine, options);
3670 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false);
3671 resolve(ret);
3672 }
3673 catch (err) {
3674 reject(err);
3675 }
3676 }));
3677 });
3678 }
3679 /**
3680 * Update tags of a list of deployment targets in a deployment group.
3681 *
3682 * @param {TaskAgentInterfaces.DeploymentTargetUpdateParameter[]} machines - Deployment targets with tags to udpdate.
3683 * @param {string} project - Project ID or project name
3684 * @param {number} deploymentGroupId - ID of the deployment group in which deployment targets are updated.
3685 */
3686 updateDeploymentTargets(machines, project, deploymentGroupId) {
3687 return __awaiter(this, void 0, void 0, function* () {
3688 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3689 let routeValues = {
3690 project: project,
3691 deploymentGroupId: deploymentGroupId
3692 };
3693 try {
3694 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues);
3695 let url = verData.requestUrl;
3696 let options = this.createRequestOptions('application/json', verData.apiVersion);
3697 let res;
3698 res = yield this.rest.update(url, machines, options);
3699 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true);
3700 resolve(ret);
3701 }
3702 catch (err) {
3703 reject(err);
3704 }
3705 }));
3706 });
3707 }
3708 /**
3709 * Create a task group.
3710 *
3711 * @param {TaskAgentInterfaces.TaskGroupCreateParameter} taskGroup - Task group object to create.
3712 * @param {string} project - Project ID or project name
3713 */
3714 addTaskGroup(taskGroup, project) {
3715 return __awaiter(this, void 0, void 0, function* () {
3716 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3717 let routeValues = {
3718 project: project
3719 };
3720 try {
3721 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues);
3722 let url = verData.requestUrl;
3723 let options = this.createRequestOptions('application/json', verData.apiVersion);
3724 let res;
3725 res = yield this.rest.create(url, taskGroup, options);
3726 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, false);
3727 resolve(ret);
3728 }
3729 catch (err) {
3730 reject(err);
3731 }
3732 }));
3733 });
3734 }
3735 /**
3736 * Delete a task group.
3737 *
3738 * @param {string} project - Project ID or project name
3739 * @param {string} taskGroupId - Id of the task group to be deleted.
3740 * @param {string} comment - Comments to delete.
3741 */
3742 deleteTaskGroup(project, taskGroupId, comment) {
3743 return __awaiter(this, void 0, void 0, function* () {
3744 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3745 let routeValues = {
3746 project: project,
3747 taskGroupId: taskGroupId
3748 };
3749 let queryValues = {
3750 comment: comment,
3751 };
3752 try {
3753 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues);
3754 let url = verData.requestUrl;
3755 let options = this.createRequestOptions('application/json', verData.apiVersion);
3756 let res;
3757 res = yield this.rest.del(url, options);
3758 let ret = this.formatResponse(res.result, null, false);
3759 resolve(ret);
3760 }
3761 catch (err) {
3762 reject(err);
3763 }
3764 }));
3765 });
3766 }
3767 /**
3768 * Get task group.
3769 *
3770 * @param {string} project - Project ID or project name
3771 * @param {string} taskGroupId - Id of the task group.
3772 * @param {string} versionSpec - version specification of the task group. examples: 1, 1.0.
3773 * @param {TaskAgentInterfaces.TaskGroupExpands} expand - The properties that should be expanded. example $expand=Tasks will expand nested task groups.
3774 */
3775 getTaskGroup(project, taskGroupId, versionSpec, expand) {
3776 return __awaiter(this, void 0, void 0, function* () {
3777 if (versionSpec == null) {
3778 throw new TypeError('versionSpec can not be null or undefined');
3779 }
3780 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3781 let routeValues = {
3782 project: project,
3783 taskGroupId: taskGroupId
3784 };
3785 let queryValues = {
3786 versionSpec: versionSpec,
3787 '$expand': expand,
3788 };
3789 try {
3790 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues);
3791 let url = verData.requestUrl;
3792 let options = this.createRequestOptions('application/json', verData.apiVersion);
3793 let res;
3794 res = yield this.rest.get(url, options);
3795 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, false);
3796 resolve(ret);
3797 }
3798 catch (err) {
3799 reject(err);
3800 }
3801 }));
3802 });
3803 }
3804 /**
3805 * @param {string} project - Project ID or project name
3806 * @param {string} taskGroupId
3807 * @param {number} revision
3808 */
3809 getTaskGroupRevision(project, taskGroupId, revision) {
3810 return __awaiter(this, void 0, void 0, function* () {
3811 if (revision == null) {
3812 throw new TypeError('revision can not be null or undefined');
3813 }
3814 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3815 let routeValues = {
3816 project: project,
3817 taskGroupId: taskGroupId
3818 };
3819 let queryValues = {
3820 revision: revision,
3821 };
3822 try {
3823 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues);
3824 let url = verData.requestUrl;
3825 let apiVersion = verData.apiVersion;
3826 let accept = this.createAcceptHeader("text/plain", apiVersion);
3827 resolve((yield this.http.get(url, { "Accept": accept })).message);
3828 }
3829 catch (err) {
3830 reject(err);
3831 }
3832 }));
3833 });
3834 }
3835 /**
3836 * List task groups.
3837 *
3838 * @param {string} project - Project ID or project name
3839 * @param {string} taskGroupId - Id of the task group.
3840 * @param {boolean} expanded - 'true' to recursively expand task groups. Default is 'false'.
3841 * @param {string} taskIdFilter - Guid of the taskId to filter.
3842 * @param {boolean} deleted - 'true'to include deleted task groups. Default is 'false'.
3843 * @param {number} top - Number of task groups to get.
3844 * @param {Date} continuationToken - Gets the task groups after the continuation token provided.
3845 * @param {TaskAgentInterfaces.TaskGroupQueryOrder} queryOrder - Gets the results in the defined order. Default is 'CreatedOnDescending'.
3846 */
3847 getTaskGroups(project, taskGroupId, expanded, taskIdFilter, deleted, top, continuationToken, queryOrder) {
3848 return __awaiter(this, void 0, void 0, function* () {
3849 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3850 let routeValues = {
3851 project: project,
3852 taskGroupId: taskGroupId
3853 };
3854 let queryValues = {
3855 expanded: expanded,
3856 taskIdFilter: taskIdFilter,
3857 deleted: deleted,
3858 '$top': top,
3859 continuationToken: continuationToken,
3860 queryOrder: queryOrder,
3861 };
3862 try {
3863 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues);
3864 let url = verData.requestUrl;
3865 let options = this.createRequestOptions('application/json', verData.apiVersion);
3866 let res;
3867 res = yield this.rest.get(url, options);
3868 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true);
3869 resolve(ret);
3870 }
3871 catch (err) {
3872 reject(err);
3873 }
3874 }));
3875 });
3876 }
3877 /**
3878 * @param {TaskAgentInterfaces.PublishTaskGroupMetadata} taskGroupMetadata
3879 * @param {string} project - Project ID or project name
3880 * @param {string} parentTaskGroupId
3881 */
3882 publishTaskGroup(taskGroupMetadata, project, parentTaskGroupId) {
3883 return __awaiter(this, void 0, void 0, function* () {
3884 if (parentTaskGroupId == null) {
3885 throw new TypeError('parentTaskGroupId can not be null or undefined');
3886 }
3887 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3888 let routeValues = {
3889 project: project
3890 };
3891 let queryValues = {
3892 parentTaskGroupId: parentTaskGroupId,
3893 };
3894 try {
3895 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues);
3896 let url = verData.requestUrl;
3897 let options = this.createRequestOptions('application/json', verData.apiVersion);
3898 let res;
3899 res = yield this.rest.replace(url, taskGroupMetadata, options);
3900 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true);
3901 resolve(ret);
3902 }
3903 catch (err) {
3904 reject(err);
3905 }
3906 }));
3907 });
3908 }
3909 /**
3910 * @param {TaskAgentInterfaces.TaskGroup} taskGroup
3911 * @param {string} project - Project ID or project name
3912 */
3913 undeleteTaskGroup(taskGroup, project) {
3914 return __awaiter(this, void 0, void 0, function* () {
3915 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3916 let routeValues = {
3917 project: project
3918 };
3919 try {
3920 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues);
3921 let url = verData.requestUrl;
3922 let options = this.createRequestOptions('application/json', verData.apiVersion);
3923 let res;
3924 res = yield this.rest.update(url, taskGroup, options);
3925 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true);
3926 resolve(ret);
3927 }
3928 catch (err) {
3929 reject(err);
3930 }
3931 }));
3932 });
3933 }
3934 /**
3935 * Update a task group.
3936 *
3937 * @param {TaskAgentInterfaces.TaskGroupUpdateParameter} taskGroup - Task group to update.
3938 * @param {string} project - Project ID or project name
3939 * @param {string} taskGroupId - Id of the task group to update.
3940 */
3941 updateTaskGroup(taskGroup, project, taskGroupId) {
3942 return __awaiter(this, void 0, void 0, function* () {
3943 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3944 let routeValues = {
3945 project: project,
3946 taskGroupId: taskGroupId
3947 };
3948 try {
3949 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues);
3950 let url = verData.requestUrl;
3951 let options = this.createRequestOptions('application/json', verData.apiVersion);
3952 let res;
3953 res = yield this.rest.replace(url, taskGroup, options);
3954 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, false);
3955 resolve(ret);
3956 }
3957 catch (err) {
3958 reject(err);
3959 }
3960 }));
3961 });
3962 }
3963 /**
3964 * @param {TaskAgentInterfaces.TaskGroupUpdatePropertiesBase} taskGroupUpdateProperties
3965 * @param {string} project - Project ID or project name
3966 * @param {string} taskGroupId
3967 * @param {boolean} disablePriorVersions
3968 */
3969 updateTaskGroupProperties(taskGroupUpdateProperties, project, taskGroupId, disablePriorVersions) {
3970 return __awaiter(this, void 0, void 0, function* () {
3971 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3972 let routeValues = {
3973 project: project,
3974 taskGroupId: taskGroupId
3975 };
3976 let queryValues = {
3977 disablePriorVersions: disablePriorVersions,
3978 };
3979 try {
3980 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues);
3981 let url = verData.requestUrl;
3982 let options = this.createRequestOptions('application/json', verData.apiVersion);
3983 let res;
3984 res = yield this.rest.update(url, taskGroupUpdateProperties, options);
3985 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true);
3986 resolve(ret);
3987 }
3988 catch (err) {
3989 reject(err);
3990 }
3991 }));
3992 });
3993 }
3994 /**
3995 * @param {string} taskId
3996 */
3997 deleteTaskDefinition(taskId) {
3998 return __awaiter(this, void 0, void 0, function* () {
3999 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4000 let routeValues = {
4001 taskId: taskId
4002 };
4003 try {
4004 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues);
4005 let url = verData.requestUrl;
4006 let options = this.createRequestOptions('application/json', verData.apiVersion);
4007 let res;
4008 res = yield this.rest.del(url, options);
4009 let ret = this.formatResponse(res.result, null, false);
4010 resolve(ret);
4011 }
4012 catch (err) {
4013 reject(err);
4014 }
4015 }));
4016 });
4017 }
4018 /**
4019 * @param {string} taskId
4020 * @param {string} versionString
4021 * @param {string[]} visibility
4022 * @param {boolean} scopeLocal
4023 */
4024 getTaskContentZip(taskId, versionString, visibility, scopeLocal) {
4025 return __awaiter(this, void 0, void 0, function* () {
4026 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4027 let routeValues = {
4028 taskId: taskId,
4029 versionString: versionString
4030 };
4031 let queryValues = {
4032 visibility: visibility,
4033 scopeLocal: scopeLocal,
4034 };
4035 try {
4036 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues);
4037 let url = verData.requestUrl;
4038 let apiVersion = verData.apiVersion;
4039 let accept = this.createAcceptHeader("application/zip", apiVersion);
4040 resolve((yield this.http.get(url, { "Accept": accept })).message);
4041 }
4042 catch (err) {
4043 reject(err);
4044 }
4045 }));
4046 });
4047 }
4048 /**
4049 * @param {string} taskId
4050 * @param {string} versionString
4051 * @param {string[]} visibility
4052 * @param {boolean} scopeLocal
4053 */
4054 getTaskDefinition(taskId, versionString, visibility, scopeLocal) {
4055 return __awaiter(this, void 0, void 0, function* () {
4056 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4057 let routeValues = {
4058 taskId: taskId,
4059 versionString: versionString
4060 };
4061 let queryValues = {
4062 visibility: visibility,
4063 scopeLocal: scopeLocal,
4064 };
4065 try {
4066 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues);
4067 let url = verData.requestUrl;
4068 let options = this.createRequestOptions('application/json', verData.apiVersion);
4069 let res;
4070 res = yield this.rest.get(url, options);
4071 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskDefinition, false);
4072 resolve(ret);
4073 }
4074 catch (err) {
4075 reject(err);
4076 }
4077 }));
4078 });
4079 }
4080 /**
4081 * @param {string} taskId
4082 * @param {string[]} visibility
4083 * @param {boolean} scopeLocal
4084 * @param {boolean} allVersions
4085 */
4086 getTaskDefinitions(taskId, visibility, scopeLocal, allVersions) {
4087 return __awaiter(this, void 0, void 0, function* () {
4088 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4089 let routeValues = {
4090 taskId: taskId
4091 };
4092 let queryValues = {
4093 visibility: visibility,
4094 scopeLocal: scopeLocal,
4095 allVersions: allVersions,
4096 };
4097 try {
4098 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues);
4099 let url = verData.requestUrl;
4100 let options = this.createRequestOptions('application/json', verData.apiVersion);
4101 let res;
4102 res = yield this.rest.get(url, options);
4103 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskDefinition, true);
4104 resolve(ret);
4105 }
4106 catch (err) {
4107 reject(err);
4108 }
4109 }));
4110 });
4111 }
4112 /**
4113 * @param {number} poolId
4114 * @param {number} agentId
4115 * @param {string} currentState
4116 */
4117 updateAgentUpdateState(poolId, agentId, currentState) {
4118 return __awaiter(this, void 0, void 0, function* () {
4119 if (currentState == null) {
4120 throw new TypeError('currentState can not be null or undefined');
4121 }
4122 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4123 let routeValues = {
4124 poolId: poolId,
4125 agentId: agentId
4126 };
4127 let queryValues = {
4128 currentState: currentState,
4129 };
4130 try {
4131 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8cc1b02b-ae49-4516-b5ad-4f9b29967c30", routeValues, queryValues);
4132 let url = verData.requestUrl;
4133 let options = this.createRequestOptions('application/json', verData.apiVersion);
4134 let res;
4135 res = yield this.rest.replace(url, null, options);
4136 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false);
4137 resolve(ret);
4138 }
4139 catch (err) {
4140 reject(err);
4141 }
4142 }));
4143 });
4144 }
4145 /**
4146 * @param {{ [key: string] : string; }} userCapabilities
4147 * @param {number} poolId
4148 * @param {number} agentId
4149 */
4150 updateAgentUserCapabilities(userCapabilities, poolId, agentId) {
4151 return __awaiter(this, void 0, void 0, function* () {
4152 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4153 let routeValues = {
4154 poolId: poolId,
4155 agentId: agentId
4156 };
4157 try {
4158 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "30ba3ada-fedf-4da8-bbb5-dacf2f82e176", routeValues);
4159 let url = verData.requestUrl;
4160 let options = this.createRequestOptions('application/json', verData.apiVersion);
4161 let res;
4162 res = yield this.rest.replace(url, userCapabilities, options);
4163 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false);
4164 resolve(ret);
4165 }
4166 catch (err) {
4167 reject(err);
4168 }
4169 }));
4170 });
4171 }
4172 /**
4173 * Add a variable group.
4174 *
4175 * @param {TaskAgentInterfaces.VariableGroupParameters} variableGroupParameters
4176 */
4177 addVariableGroup(variableGroupParameters) {
4178 return __awaiter(this, void 0, void 0, function* () {
4179 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4180 let routeValues = {};
4181 try {
4182 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues);
4183 let url = verData.requestUrl;
4184 let options = this.createRequestOptions('application/json', verData.apiVersion);
4185 let res;
4186 res = yield this.rest.create(url, variableGroupParameters, options);
4187 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, false);
4188 resolve(ret);
4189 }
4190 catch (err) {
4191 reject(err);
4192 }
4193 }));
4194 });
4195 }
4196 /**
4197 * Delete a variable group
4198 *
4199 * @param {number} groupId - Id of the variable group.
4200 * @param {string[]} projectIds
4201 */
4202 deleteVariableGroup(groupId, projectIds) {
4203 return __awaiter(this, void 0, void 0, function* () {
4204 if (projectIds == null) {
4205 throw new TypeError('projectIds can not be null or undefined');
4206 }
4207 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4208 let routeValues = {
4209 groupId: groupId
4210 };
4211 let queryValues = {
4212 projectIds: projectIds && projectIds.join(","),
4213 };
4214 try {
4215 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues, queryValues);
4216 let url = verData.requestUrl;
4217 let options = this.createRequestOptions('application/json', verData.apiVersion);
4218 let res;
4219 res = yield this.rest.del(url, options);
4220 let ret = this.formatResponse(res.result, null, false);
4221 resolve(ret);
4222 }
4223 catch (err) {
4224 reject(err);
4225 }
4226 }));
4227 });
4228 }
4229 /**
4230 * Add a variable group.
4231 *
4232 * @param {TaskAgentInterfaces.VariableGroupProjectReference[]} variableGroupProjectReferences
4233 * @param {number} variableGroupId
4234 */
4235 shareVariableGroup(variableGroupProjectReferences, variableGroupId) {
4236 return __awaiter(this, void 0, void 0, function* () {
4237 if (variableGroupId == null) {
4238 throw new TypeError('variableGroupId can not be null or undefined');
4239 }
4240 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4241 let routeValues = {};
4242 let queryValues = {
4243 variableGroupId: variableGroupId,
4244 };
4245 try {
4246 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues, queryValues);
4247 let url = verData.requestUrl;
4248 let options = this.createRequestOptions('application/json', verData.apiVersion);
4249 let res;
4250 res = yield this.rest.update(url, variableGroupProjectReferences, options);
4251 let ret = this.formatResponse(res.result, null, false);
4252 resolve(ret);
4253 }
4254 catch (err) {
4255 reject(err);
4256 }
4257 }));
4258 });
4259 }
4260 /**
4261 * Update a variable group.
4262 *
4263 * @param {TaskAgentInterfaces.VariableGroupParameters} variableGroupParameters
4264 * @param {number} groupId - Id of the variable group to update.
4265 */
4266 updateVariableGroup(variableGroupParameters, groupId) {
4267 return __awaiter(this, void 0, void 0, function* () {
4268 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4269 let routeValues = {
4270 groupId: groupId
4271 };
4272 try {
4273 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues);
4274 let url = verData.requestUrl;
4275 let options = this.createRequestOptions('application/json', verData.apiVersion);
4276 let res;
4277 res = yield this.rest.replace(url, variableGroupParameters, options);
4278 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, false);
4279 resolve(ret);
4280 }
4281 catch (err) {
4282 reject(err);
4283 }
4284 }));
4285 });
4286 }
4287 /**
4288 * Get a variable group.
4289 *
4290 * @param {string} project - Project ID or project name
4291 * @param {number} groupId - Id of the variable group.
4292 */
4293 getVariableGroup(project, groupId) {
4294 return __awaiter(this, void 0, void 0, function* () {
4295 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4296 let routeValues = {
4297 project: project,
4298 groupId: groupId
4299 };
4300 try {
4301 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "f5b09dd5-9d54-45a1-8b5a-1c8287d634cc", routeValues);
4302 let url = verData.requestUrl;
4303 let options = this.createRequestOptions('application/json', verData.apiVersion);
4304 let res;
4305 res = yield this.rest.get(url, options);
4306 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, false);
4307 resolve(ret);
4308 }
4309 catch (err) {
4310 reject(err);
4311 }
4312 }));
4313 });
4314 }
4315 /**
4316 * Get variable groups.
4317 *
4318 * @param {string} project - Project ID or project name
4319 * @param {string} groupName - Name of variable group.
4320 * @param {TaskAgentInterfaces.VariableGroupActionFilter} actionFilter - Action filter for the variable group. It specifies the action which can be performed on the variable groups.
4321 * @param {number} top - Number of variable groups to get.
4322 * @param {number} continuationToken - Gets the variable groups after the continuation token provided.
4323 * @param {TaskAgentInterfaces.VariableGroupQueryOrder} queryOrder - Gets the results in the defined order. Default is 'IdDescending'.
4324 */
4325 getVariableGroups(project, groupName, actionFilter, top, continuationToken, queryOrder) {
4326 return __awaiter(this, void 0, void 0, function* () {
4327 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4328 let routeValues = {
4329 project: project
4330 };
4331 let queryValues = {
4332 groupName: groupName,
4333 actionFilter: actionFilter,
4334 '$top': top,
4335 continuationToken: continuationToken,
4336 queryOrder: queryOrder,
4337 };
4338 try {
4339 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "f5b09dd5-9d54-45a1-8b5a-1c8287d634cc", routeValues, queryValues);
4340 let url = verData.requestUrl;
4341 let options = this.createRequestOptions('application/json', verData.apiVersion);
4342 let res;
4343 res = yield this.rest.get(url, options);
4344 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, true);
4345 resolve(ret);
4346 }
4347 catch (err) {
4348 reject(err);
4349 }
4350 }));
4351 });
4352 }
4353 /**
4354 * Get variable groups by ids.
4355 *
4356 * @param {string} project - Project ID or project name
4357 * @param {number[]} groupIds - Comma separated list of Ids of variable groups.
4358 * @param {boolean} loadSecrets
4359 */
4360 getVariableGroupsById(project, groupIds, loadSecrets) {
4361 return __awaiter(this, void 0, void 0, function* () {
4362 if (groupIds == null) {
4363 throw new TypeError('groupIds can not be null or undefined');
4364 }
4365 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4366 let routeValues = {
4367 project: project
4368 };
4369 let queryValues = {
4370 groupIds: groupIds && groupIds.join(","),
4371 loadSecrets: loadSecrets,
4372 };
4373 try {
4374 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "f5b09dd5-9d54-45a1-8b5a-1c8287d634cc", routeValues, queryValues);
4375 let url = verData.requestUrl;
4376 let options = this.createRequestOptions('application/json', verData.apiVersion);
4377 let res;
4378 res = yield this.rest.get(url, options);
4379 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, true);
4380 resolve(ret);
4381 }
4382 catch (err) {
4383 reject(err);
4384 }
4385 }));
4386 });
4387 }
4388 /**
4389 * @param {TaskAgentInterfaces.VirtualMachineGroupCreateParameters} createParameters
4390 * @param {string} project - Project ID or project name
4391 * @param {number} environmentId
4392 */
4393 addVirtualMachineGroup(createParameters, project, environmentId) {
4394 return __awaiter(this, void 0, void 0, function* () {
4395 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4396 let routeValues = {
4397 project: project,
4398 environmentId: environmentId
4399 };
4400 try {
4401 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues);
4402 let url = verData.requestUrl;
4403 let options = this.createRequestOptions('application/json', verData.apiVersion);
4404 let res;
4405 res = yield this.rest.create(url, createParameters, options);
4406 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachineGroup, false);
4407 resolve(ret);
4408 }
4409 catch (err) {
4410 reject(err);
4411 }
4412 }));
4413 });
4414 }
4415 /**
4416 * @param {string} project - Project ID or project name
4417 * @param {number} environmentId
4418 * @param {number} resourceId
4419 */
4420 deleteVirtualMachineGroup(project, environmentId, resourceId) {
4421 return __awaiter(this, void 0, void 0, function* () {
4422 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4423 let routeValues = {
4424 project: project,
4425 environmentId: environmentId,
4426 resourceId: resourceId
4427 };
4428 try {
4429 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues);
4430 let url = verData.requestUrl;
4431 let options = this.createRequestOptions('application/json', verData.apiVersion);
4432 let res;
4433 res = yield this.rest.del(url, options);
4434 let ret = this.formatResponse(res.result, null, false);
4435 resolve(ret);
4436 }
4437 catch (err) {
4438 reject(err);
4439 }
4440 }));
4441 });
4442 }
4443 /**
4444 * @param {string} project - Project ID or project name
4445 * @param {number} environmentId
4446 * @param {number} resourceId
4447 */
4448 getVirtualMachineGroup(project, environmentId, resourceId) {
4449 return __awaiter(this, void 0, void 0, function* () {
4450 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4451 let routeValues = {
4452 project: project,
4453 environmentId: environmentId,
4454 resourceId: resourceId
4455 };
4456 try {
4457 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues);
4458 let url = verData.requestUrl;
4459 let options = this.createRequestOptions('application/json', verData.apiVersion);
4460 let res;
4461 res = yield this.rest.get(url, options);
4462 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachineGroup, false);
4463 resolve(ret);
4464 }
4465 catch (err) {
4466 reject(err);
4467 }
4468 }));
4469 });
4470 }
4471 /**
4472 * @param {TaskAgentInterfaces.VirtualMachineGroup} resource
4473 * @param {string} project - Project ID or project name
4474 * @param {number} environmentId
4475 */
4476 updateVirtualMachineGroup(resource, project, environmentId) {
4477 return __awaiter(this, void 0, void 0, function* () {
4478 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4479 let routeValues = {
4480 project: project,
4481 environmentId: environmentId
4482 };
4483 try {
4484 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues);
4485 let url = verData.requestUrl;
4486 let options = this.createRequestOptions('application/json', verData.apiVersion);
4487 let res;
4488 res = yield this.rest.update(url, resource, options);
4489 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachineGroup, false);
4490 resolve(ret);
4491 }
4492 catch (err) {
4493 reject(err);
4494 }
4495 }));
4496 });
4497 }
4498 /**
4499 * @param {string} project - Project ID or project name
4500 * @param {number} environmentId
4501 * @param {number} resourceId
4502 * @param {string} continuationToken
4503 * @param {string} name
4504 * @param {boolean} partialNameMatch
4505 * @param {string[]} tags
4506 * @param {number} top
4507 */
4508 getVirtualMachines(project, environmentId, resourceId, continuationToken, name, partialNameMatch, tags, top) {
4509 return __awaiter(this, void 0, void 0, function* () {
4510 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4511 let routeValues = {
4512 project: project,
4513 environmentId: environmentId,
4514 resourceId: resourceId
4515 };
4516 let queryValues = {
4517 continuationToken: continuationToken,
4518 name: name,
4519 partialNameMatch: partialNameMatch,
4520 tags: tags && tags.join(","),
4521 '$top': top,
4522 };
4523 try {
4524 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "48700676-2ba5-4282-8ec8-083280d169c7", routeValues, queryValues);
4525 let url = verData.requestUrl;
4526 let options = this.createRequestOptions('application/json', verData.apiVersion);
4527 let res;
4528 res = yield this.rest.get(url, options);
4529 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachine, true);
4530 resolve(ret);
4531 }
4532 catch (err) {
4533 reject(err);
4534 }
4535 }));
4536 });
4537 }
4538 /**
4539 * @param {TaskAgentInterfaces.VirtualMachine[]} machines
4540 * @param {string} project - Project ID or project name
4541 * @param {number} environmentId
4542 * @param {number} resourceId
4543 */
4544 updateVirtualMachines(machines, project, environmentId, resourceId) {
4545 return __awaiter(this, void 0, void 0, function* () {
4546 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4547 let routeValues = {
4548 project: project,
4549 environmentId: environmentId,
4550 resourceId: resourceId
4551 };
4552 try {
4553 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "48700676-2ba5-4282-8ec8-083280d169c7", routeValues);
4554 let url = verData.requestUrl;
4555 let options = this.createRequestOptions('application/json', verData.apiVersion);
4556 let res;
4557 res = yield this.rest.update(url, machines, options);
4558 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachine, true);
4559 resolve(ret);
4560 }
4561 catch (err) {
4562 reject(err);
4563 }
4564 }));
4565 });
4566 }
4567 /**
4568 * @param {string} tenantId
4569 * @param {string} redirectUri
4570 * @param {TaskAgentInterfaces.AadLoginPromptOption} promptOption
4571 * @param {string} completeCallbackPayload
4572 * @param {boolean} completeCallbackByAuthCode
4573 */
4574 createAadOAuthRequest(tenantId, redirectUri, promptOption, completeCallbackPayload, completeCallbackByAuthCode) {
4575 return __awaiter(this, void 0, void 0, function* () {
4576 if (tenantId == null) {
4577 throw new TypeError('tenantId can not be null or undefined');
4578 }
4579 if (redirectUri == null) {
4580 throw new TypeError('redirectUri can not be null or undefined');
4581 }
4582 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4583 let routeValues = {};
4584 let queryValues = {
4585 tenantId: tenantId,
4586 redirectUri: redirectUri,
4587 promptOption: promptOption,
4588 completeCallbackPayload: completeCallbackPayload,
4589 completeCallbackByAuthCode: completeCallbackByAuthCode,
4590 };
4591 try {
4592 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9c63205e-3a0f-42a0-ad88-095200f13607", routeValues, queryValues);
4593 let url = verData.requestUrl;
4594 let options = this.createRequestOptions('application/json', verData.apiVersion);
4595 let res;
4596 res = yield this.rest.create(url, null, options);
4597 let ret = this.formatResponse(res.result, null, false);
4598 resolve(ret);
4599 }
4600 catch (err) {
4601 reject(err);
4602 }
4603 }));
4604 });
4605 }
4606 /**
4607 */
4608 getVstsAadTenantId() {
4609 return __awaiter(this, void 0, void 0, function* () {
4610 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4611 let routeValues = {};
4612 try {
4613 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9c63205e-3a0f-42a0-ad88-095200f13607", routeValues);
4614 let url = verData.requestUrl;
4615 let options = this.createRequestOptions('application/json', verData.apiVersion);
4616 let res;
4617 res = yield this.rest.get(url, options);
4618 let ret = this.formatResponse(res.result, null, false);
4619 resolve(ret);
4620 }
4621 catch (err) {
4622 reject(err);
4623 }
4624 }));
4625 });
4626 }
4627 /**
4628 * GET the Yaml schema used for Yaml file validation.
4629 *
4630 * @param {boolean} validateTaskNames - Whether the schema should validate that tasks are actually installed (useful for offline tools where you don't want validation).
4631 */
4632 getYamlSchema(validateTaskNames) {
4633 return __awaiter(this, void 0, void 0, function* () {
4634 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4635 let routeValues = {};
4636 let queryValues = {
4637 validateTaskNames: validateTaskNames,
4638 };
4639 try {
4640 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "1f9990b9-1dba-441f-9c2e-6485888c42b6", routeValues, queryValues);
4641 let url = verData.requestUrl;
4642 let options = this.createRequestOptions('application/json', verData.apiVersion);
4643 let res;
4644 res = yield this.rest.get(url, options);
4645 let ret = this.formatResponse(res.result, null, false);
4646 resolve(ret);
4647 }
4648 catch (err) {
4649 reject(err);
4650 }
4651 }));
4652 });
4653 }
4654}
4655exports.TaskAgentApiBase = TaskAgentApiBase;
4656TaskAgentApiBase.RESOURCE_AREA_ID = "a85b8835-c1a1-4aac-ae97-1c3d0ba72dbd";