2019-10-10 00:52:42 -04:00
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*
* See following wiki page for instructions on how to regenerate:
* https://aka.ms/azure-devops-client-generation
*
* Configuration file:
* distributedtask\client\webapi\clientgeneratorconfigs\genclient.json
*/
using System ;
using System.Collections.Generic ;
using System.Collections.Specialized ;
using System.ComponentModel ;
using System.Globalization ;
using System.IO ;
using System.IO.Compression ;
using System.Linq ;
using System.Net.Http ;
using System.Net.Http.Headers ;
using System.Net.Http.Formatting ;
using System.Threading ;
using System.Threading.Tasks ;
using GitHub.Services.Common ;
using GitHub.Services.WebApi ;
namespace GitHub.DistributedTask.WebApi
{
[ResourceArea(TaskResourceIds.AreaId)]
2019-12-16 17:05:26 -05:00
public abstract class TaskAgentHttpClientBase : VssHttpClientBase
2019-10-10 00:52:42 -04:00
{
public TaskAgentHttpClientBase ( Uri baseUrl , VssCredentials credentials )
: base ( baseUrl , credentials )
{
}
public TaskAgentHttpClientBase ( Uri baseUrl , VssCredentials credentials , VssHttpRequestSettings settings )
: base ( baseUrl , credentials , settings )
{
}
public TaskAgentHttpClientBase ( Uri baseUrl , VssCredentials credentials , params DelegatingHandler [ ] handlers )
: base ( baseUrl , credentials , handlers )
{
}
public TaskAgentHttpClientBase ( Uri baseUrl , VssCredentials credentials , VssHttpRequestSettings settings , params DelegatingHandler [ ] handlers )
: base ( baseUrl , credentials , settings , handlers )
{
}
public TaskAgentHttpClientBase ( Uri baseUrl , HttpMessageHandler pipeline , bool disposeHandler )
: base ( baseUrl , pipeline , disposeHandler )
{
}
/// <summary>
/// [Preview API] 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.
/// </summary>
/// <param name="poolId">The agent pool in which to add the agent</param>
/// <param name="agent">Details about the agent being added</param>
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
public virtual Task < TaskAgent > AddAgentAsync (
int poolId ,
TaskAgent agent ,
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "POST" ) ;
Guid locationId = new Guid ( "e298ef32-5878-4cab-993c-043836571f42" ) ;
object routeValues = new { poolId = poolId } ;
HttpContent content = new ObjectContent < TaskAgent > ( agent , new VssJsonMediaTypeFormatter ( true ) ) ;
return SendAsync < TaskAgent > (
httpMethod ,
locationId ,
routeValues : routeValues ,
2020-04-13 21:33:13 -04:00
version : new ApiResourceVersion ( 6.0 , 2 ) ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ,
content : content ) ;
}
/// <summary>
/// [Preview API] 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.
/// </summary>
/// <param name="poolId">The pool ID to remove the agent from</param>
/// <param name="agentId">The agent ID to remove</param>
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
public virtual async Task DeleteAgentAsync (
int poolId ,
2023-08-04 16:22:52 -04:00
ulong agentId ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "DELETE" ) ;
Guid locationId = new Guid ( "e298ef32-5878-4cab-993c-043836571f42" ) ;
object routeValues = new { poolId = poolId , agentId = agentId } ;
using ( HttpResponseMessage response = await SendAsync (
httpMethod ,
locationId ,
routeValues : routeValues ,
2020-04-13 21:33:13 -04:00
version : new ApiResourceVersion ( 6.0 , 2 ) ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
{
return ;
}
}
/// <summary>
/// [Preview API] Get information about an agent.
/// </summary>
/// <param name="poolId">The agent pool containing the agent</param>
/// <param name="agentId">The agent ID to get information about</param>
/// <param name="includeCapabilities">Whether to include the agent's capabilities in the response</param>
/// <param name="includeAssignedRequest">Whether to include details about the agent's current work</param>
/// <param name="includeLastCompletedRequest">Whether to include details about the agents' most recent completed work</param>
/// <param name="propertyFilters">Filter which custom properties will be returned</param>
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
public virtual Task < TaskAgent > GetAgentAsync (
int poolId ,
int agentId ,
bool? includeCapabilities = null ,
bool? includeAssignedRequest = null ,
bool? includeLastCompletedRequest = null ,
IEnumerable < string > propertyFilters = null ,
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
Guid locationId = new Guid ( "e298ef32-5878-4cab-993c-043836571f42" ) ;
object routeValues = new { poolId = poolId , agentId = agentId } ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
if ( includeCapabilities ! = null )
{
queryParams . Add ( "includeCapabilities" , includeCapabilities . Value . ToString ( ) ) ;
}
if ( includeAssignedRequest ! = null )
{
queryParams . Add ( "includeAssignedRequest" , includeAssignedRequest . Value . ToString ( ) ) ;
}
if ( includeLastCompletedRequest ! = null )
{
queryParams . Add ( "includeLastCompletedRequest" , includeLastCompletedRequest . Value . ToString ( ) ) ;
}
if ( propertyFilters ! = null & & propertyFilters . Any ( ) )
{
queryParams . Add ( "propertyFilters" , string . Join ( "," , propertyFilters ) ) ;
}
return SendAsync < TaskAgent > (
httpMethod ,
locationId ,
routeValues : routeValues ,
2020-04-13 21:33:13 -04:00
version : new ApiResourceVersion ( 6.0 , 2 ) ,
2019-10-10 00:52:42 -04:00
queryParameters : queryParams ,
userState : userState ,
cancellationToken : cancellationToken ) ;
}
/// <summary>
/// [Preview API] Get a list of agents.
/// </summary>
/// <param name="poolId">The agent pool containing the agents</param>
/// <param name="agentName">Filter on agent name</param>
/// <param name="includeCapabilities">Whether to include the agents' capabilities in the response</param>
/// <param name="includeAssignedRequest">Whether to include details about the agents' current work</param>
/// <param name="includeLastCompletedRequest">Whether to include details about the agents' most recent completed work</param>
/// <param name="propertyFilters">Filter which custom properties will be returned</param>
/// <param name="demands">Filter by demands the agents can satisfy</param>
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
public virtual Task < List < TaskAgent > > GetAgentsAsync (
int poolId ,
string agentName = null ,
bool? includeCapabilities = null ,
bool? includeAssignedRequest = null ,
bool? includeLastCompletedRequest = null ,
IEnumerable < string > propertyFilters = null ,
IEnumerable < string > demands = null ,
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
Guid locationId = new Guid ( "e298ef32-5878-4cab-993c-043836571f42" ) ;
object routeValues = new { poolId = poolId } ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
if ( agentName ! = null )
{
queryParams . Add ( "agentName" , agentName ) ;
}
if ( includeCapabilities ! = null )
{
queryParams . Add ( "includeCapabilities" , includeCapabilities . Value . ToString ( ) ) ;
}
if ( includeAssignedRequest ! = null )
{
queryParams . Add ( "includeAssignedRequest" , includeAssignedRequest . Value . ToString ( ) ) ;
}
if ( includeLastCompletedRequest ! = null )
{
queryParams . Add ( "includeLastCompletedRequest" , includeLastCompletedRequest . Value . ToString ( ) ) ;
}
if ( propertyFilters ! = null & & propertyFilters . Any ( ) )
{
queryParams . Add ( "propertyFilters" , string . Join ( "," , propertyFilters ) ) ;
}
if ( demands ! = null & & demands . Any ( ) )
{
queryParams . Add ( "demands" , string . Join ( "," , demands ) ) ;
}
return SendAsync < List < TaskAgent > > (
httpMethod ,
locationId ,
routeValues : routeValues ,
2020-04-13 21:33:13 -04:00
version : new ApiResourceVersion ( 6.0 , 2 ) ,
2019-10-10 00:52:42 -04:00
queryParameters : queryParams ,
userState : userState ,
cancellationToken : cancellationToken ) ;
}
/// <summary>
/// [Preview API] 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.
/// </summary>
/// <param name="poolId">The agent pool to use</param>
/// <param name="agentId">The agent to replace</param>
/// <param name="agent">Updated details about the replacing agent</param>
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
public virtual Task < TaskAgent > ReplaceAgentAsync (
int poolId ,
2023-08-04 16:22:52 -04:00
ulong agentId ,
2019-10-10 00:52:42 -04:00
TaskAgent agent ,
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "PUT" ) ;
Guid locationId = new Guid ( "e298ef32-5878-4cab-993c-043836571f42" ) ;
object routeValues = new { poolId = poolId , agentId = agentId } ;
HttpContent content = new ObjectContent < TaskAgent > ( agent , new VssJsonMediaTypeFormatter ( true ) ) ;
return SendAsync < TaskAgent > (
httpMethod ,
locationId ,
routeValues : routeValues ,
2020-04-13 21:33:13 -04:00
version : new ApiResourceVersion ( 6.0 , 2 ) ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ,
content : content ) ;
}
/// <summary>
/// [Preview API] Update agent details.
/// </summary>
/// <param name="poolId">The agent pool to use</param>
/// <param name="agentId">The agent to update</param>
/// <param name="agent">Updated details about the agent</param>
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
public virtual Task < TaskAgent > UpdateAgentAsync (
int poolId ,
int agentId ,
TaskAgent agent ,
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "PATCH" ) ;
Guid locationId = new Guid ( "e298ef32-5878-4cab-993c-043836571f42" ) ;
object routeValues = new { poolId = poolId , agentId = agentId } ;
HttpContent content = new ObjectContent < TaskAgent > ( agent , new VssJsonMediaTypeFormatter ( true ) ) ;
return SendAsync < TaskAgent > (
httpMethod ,
locationId ,
routeValues : routeValues ,
2020-04-13 21:33:13 -04:00
version : new ApiResourceVersion ( 6.0 , 2 ) ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ,
content : content ) ;
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API]
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="requestId"></param>
/// <param name="lockToken"></param>
/// <param name="result"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual async Task DeleteAgentRequestAsync (
int poolId ,
long requestId ,
Guid lockToken ,
TaskResult ? result = null ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "DELETE" ) ;
Guid locationId = new Guid ( "fc825784-c92a-4299-9221-998a02d1b54f" ) ;
object routeValues = new { poolId = poolId , requestId = requestId } ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "lockToken" , lockToken . ToString ( ) ) ;
if ( result ! = null )
{
queryParams . Add ( "result" , result . Value . ToString ( ) ) ;
}
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
using ( HttpResponseMessage response = await SendAsync (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
2019-12-16 17:05:26 -05:00
routeValues : routeValues ,
2019-10-10 00:52:42 -04:00
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
2019-12-16 17:05:26 -05:00
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
{
return ;
}
2019-10-10 00:52:42 -04:00
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API]
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="requestId"></param>
/// <param name="includeStatus"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual Task < TaskAgentJobRequest > GetAgentRequestAsync (
int poolId ,
long requestId ,
bool? includeStatus = null ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
2019-12-16 17:05:26 -05:00
Guid locationId = new Guid ( "fc825784-c92a-4299-9221-998a02d1b54f" ) ;
object routeValues = new { poolId = poolId , requestId = requestId } ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
if ( includeStatus ! = null )
{
queryParams . Add ( "includeStatus" , includeStatus . Value . ToString ( ) ) ;
}
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
return SendAsync < TaskAgentJobRequest > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
2019-12-16 17:05:26 -05:00
routeValues : routeValues ,
2019-10-10 00:52:42 -04:00
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ) ;
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API]
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="requestId"></param>
/// <param name="lockToken"></param>
/// <param name="request"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual Task < TaskAgentJobRequest > UpdateAgentRequestAsync (
int poolId ,
long requestId ,
Guid lockToken ,
TaskAgentJobRequest request ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "PATCH" ) ;
Guid locationId = new Guid ( "fc825784-c92a-4299-9221-998a02d1b54f" ) ;
object routeValues = new { poolId = poolId , requestId = requestId } ;
HttpContent content = new ObjectContent < TaskAgentJobRequest > ( request , new VssJsonMediaTypeFormatter ( true ) ) ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "lockToken" , lockToken . ToString ( ) ) ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
return SendAsync < TaskAgentJobRequest > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
2019-12-16 17:05:26 -05:00
cancellationToken : cancellationToken ,
content : content ) ;
2019-10-10 00:52:42 -04:00
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API]
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="messageId"></param>
/// <param name="sessionId"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual async Task DeleteMessageAsync (
int poolId ,
long messageId ,
Guid sessionId ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "DELETE" ) ;
Guid locationId = new Guid ( "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7" ) ;
object routeValues = new { poolId = poolId , messageId = messageId } ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "sessionId" , sessionId . ToString ( ) ) ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
using ( HttpResponseMessage response = await SendAsync (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
2019-12-16 17:05:26 -05:00
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
{
return ;
}
2019-10-10 00:52:42 -04:00
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API]
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="sessionId"></param>
/// <param name="lastMessageId"></param>
2022-11-21 16:17:47 +01:00
/// <param name="status"></param>
/// <param name="runnerVersion"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
2019-12-16 17:05:26 -05:00
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual Task < TaskAgentMessage > GetMessageAsync (
int poolId ,
Guid sessionId ,
long? lastMessageId = null ,
2022-07-28 16:42:02 -04:00
TaskAgentStatus ? status = null ,
2022-11-21 16:17:47 +01:00
string runnerVersion = null ,
2023-10-09 15:14:00 -04:00
string os = null ,
string architecture = null ,
2023-11-13 10:19:42 -05:00
bool? disableUpdate = null ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
Guid locationId = new Guid ( "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7" ) ;
object routeValues = new { poolId = poolId } ;
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "sessionId" , sessionId . ToString ( ) ) ;
if ( lastMessageId ! = null )
{
queryParams . Add ( "lastMessageId" , lastMessageId . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
}
2022-07-28 16:42:02 -04:00
if ( status ! = null )
{
queryParams . Add ( "status" , status . Value . ToString ( ) ) ;
}
2022-11-21 16:17:47 +01:00
if ( runnerVersion ! = null )
{
queryParams . Add ( "runnerVersion" , runnerVersion ) ;
}
2019-10-10 00:52:42 -04:00
2023-10-09 15:14:00 -04:00
if ( os ! = null )
{
queryParams . Add ( "os" , os ) ;
}
if ( architecture ! = null )
{
queryParams . Add ( "architecture" , architecture ) ;
}
2023-11-13 10:19:42 -05:00
if ( disableUpdate ! = null )
{
queryParams . Add ( "disableUpdate" , disableUpdate . Value . ToString ( ) . ToLower ( ) ) ;
}
2019-12-16 17:05:26 -05:00
return SendAsync < TaskAgentMessage > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
2022-11-21 16:17:47 +01:00
version : new ApiResourceVersion ( 6.0 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
2019-12-16 17:05:26 -05:00
cancellationToken : cancellationToken ) ;
2019-10-10 00:52:42 -04:00
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API]
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="agentId"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual async Task RefreshAgentAsync (
int poolId ,
int agentId ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "POST" ) ;
2019-12-16 17:05:26 -05:00
Guid locationId = new Guid ( "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7" ) ;
object routeValues = new { poolId = poolId } ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "agentId" , agentId . ToString ( CultureInfo . InvariantCulture ) ) ;
2019-10-10 00:52:42 -04:00
using ( HttpResponseMessage response = await SendAsync (
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
{
return ;
}
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual async Task RefreshAgentsAsync (
int poolId ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "POST" ) ;
Guid locationId = new Guid ( "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7" ) ;
object routeValues = new { poolId = poolId } ;
2019-10-10 00:52:42 -04:00
using ( HttpResponseMessage response = await SendAsync (
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
userState : userState ,
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
{
return ;
}
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="requestId"></param>
/// <param name="message"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual async Task SendMessageAsync (
int poolId ,
long requestId ,
TaskAgentMessage message ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "POST" ) ;
Guid locationId = new Guid ( "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7" ) ;
object routeValues = new { poolId = poolId } ;
HttpContent content = new ObjectContent < TaskAgentMessage > ( message , new VssJsonMediaTypeFormatter ( true ) ) ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "requestId" , requestId . ToString ( CultureInfo . InvariantCulture ) ) ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
using ( HttpResponseMessage response = await SendAsync (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ,
2019-12-16 17:05:26 -05:00
content : content ) . ConfigureAwait ( false ) )
{
return ;
}
2019-10-10 00:52:42 -04:00
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="packageType"></param>
/// <param name="platform"></param>
/// <param name="version"></param>
2021-01-23 14:19:59 -05:00
/// <param name="includeToken"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual Task < PackageMetadata > GetPackageAsync (
string packageType ,
string platform ,
string version ,
2021-01-23 14:19:59 -05:00
bool? includeToken = null ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
Guid locationId = new Guid ( "8ffcd551-079c-493a-9c02-54346299d144" ) ;
object routeValues = new { packageType = packageType , platform = platform , version = version } ;
2019-10-10 00:52:42 -04:00
2021-01-23 14:19:59 -05:00
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
if ( includeToken ! = null )
{
queryParams . Add ( "includeToken" , includeToken . Value . ToString ( ) ) ;
}
2019-12-16 17:05:26 -05:00
return SendAsync < PackageMetadata > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
2019-12-16 17:05:26 -05:00
version : new ApiResourceVersion ( 5.1 , 2 ) ,
2021-01-23 14:19:59 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
2019-12-16 17:05:26 -05:00
cancellationToken : cancellationToken ) ;
2019-10-10 00:52:42 -04:00
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="packageType"></param>
/// <param name="platform"></param>
2019-10-10 00:52:42 -04:00
/// <param name="top"></param>
2021-01-23 14:19:59 -05:00
/// <param name="includeToken"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual Task < List < PackageMetadata > > GetPackagesAsync (
string packageType ,
string platform = null ,
2019-10-10 00:52:42 -04:00
int? top = null ,
2021-01-23 14:19:59 -05:00
bool? includeToken = null ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
2019-12-16 17:05:26 -05:00
Guid locationId = new Guid ( "8ffcd551-079c-493a-9c02-54346299d144" ) ;
object routeValues = new { packageType = packageType , platform = platform } ;
2019-10-10 00:52:42 -04:00
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
if ( top ! = null )
{
queryParams . Add ( "$top" , top . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
}
2021-01-23 14:19:59 -05:00
if ( includeToken ! = null )
{
queryParams . Add ( "includeToken" , includeToken . Value . ToString ( ) ) ;
}
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
return SendAsync < List < PackageMetadata > > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
2019-12-16 17:05:26 -05:00
version : new ApiResourceVersion ( 5.1 , 2 ) ,
2019-10-10 00:52:42 -04:00
queryParameters : queryParams ,
userState : userState ,
cancellationToken : cancellationToken ) ;
}
/// <summary>
2019-12-16 17:05:26 -05:00
/// [Preview API] Get a list of agent pools.
2019-10-10 00:52:42 -04:00
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolName">Filter by name</param>
/// <param name="properties">Filter by agent pool properties (comma-separated)</param>
/// <param name="poolType">Filter by pool type</param>
/// <param name="actionFilter">Filter by whether the calling user has use or manage permissions</param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
2019-12-16 17:05:26 -05:00
public virtual Task < List < TaskAgentPool > > GetAgentPoolsAsync (
string poolName = null ,
IEnumerable < string > properties = null ,
TaskAgentPoolType ? poolType = null ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
HttpMethod httpMethod = new HttpMethod ( "GET" ) ;
2019-12-16 17:05:26 -05:00
Guid locationId = new Guid ( "a8c47e17-4d56-4a56-92bb-de7ea7dc65be" ) ;
2019-10-10 00:52:42 -04:00
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
2019-12-16 17:05:26 -05:00
if ( poolName ! = null )
2019-10-10 00:52:42 -04:00
{
2019-12-16 17:05:26 -05:00
queryParams . Add ( "poolName" , poolName ) ;
2019-10-10 00:52:42 -04:00
}
2019-12-16 17:05:26 -05:00
if ( properties ! = null & & properties . Any ( ) )
2019-10-10 00:52:42 -04:00
{
2019-12-16 17:05:26 -05:00
queryParams . Add ( "properties" , string . Join ( "," , properties ) ) ;
2019-10-10 00:52:42 -04:00
}
2019-12-16 17:05:26 -05:00
if ( poolType ! = null )
2019-10-10 00:52:42 -04:00
{
2019-12-16 17:05:26 -05:00
queryParams . Add ( "poolType" , poolType . Value . ToString ( ) ) ;
2019-10-10 00:52:42 -04:00
}
2019-12-16 17:05:26 -05:00
return SendAsync < List < TaskAgentPool > > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
queryParameters : queryParams ,
userState : userState ,
cancellationToken : cancellationToken ) ;
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="session"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual Task < TaskAgentSession > CreateAgentSessionAsync (
int poolId ,
TaskAgentSession session ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "POST" ) ;
Guid locationId = new Guid ( "134e239e-2df3-4794-a6f6-24f1f19ec8dc" ) ;
object routeValues = new { poolId = poolId } ;
HttpContent content = new ObjectContent < TaskAgentSession > ( session , new VssJsonMediaTypeFormatter ( true ) ) ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
return SendAsync < TaskAgentSession > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
userState : userState ,
cancellationToken : cancellationToken ,
content : content ) ;
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="sessionId"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual async Task DeleteAgentSessionAsync (
int poolId ,
Guid sessionId ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "DELETE" ) ;
Guid locationId = new Guid ( "134e239e-2df3-4794-a6f6-24f1f19ec8dc" ) ;
object routeValues = new { poolId = poolId , sessionId = sessionId } ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
using ( HttpResponseMessage response = await SendAsync (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
routeValues : routeValues ,
version : new ApiResourceVersion ( 5.1 , 1 ) ,
userState : userState ,
2019-12-16 17:05:26 -05:00
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
2019-10-10 00:52:42 -04:00
{
2019-12-16 17:05:26 -05:00
return ;
2019-10-10 00:52:42 -04:00
}
}
/// <summary>
/// [Preview API]
/// </summary>
2019-12-16 17:05:26 -05:00
/// <param name="poolId"></param>
/// <param name="agentId"></param>
/// <param name="currentState"></param>
2021-11-22 18:27:57 -05:00
/// <param name="updateTrace"></param>
2019-10-10 00:52:42 -04:00
/// <param name="userState"></param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
2019-12-16 17:05:26 -05:00
public virtual Task < TaskAgent > UpdateAgentUpdateStateAsync (
int poolId ,
2023-08-04 16:22:52 -04:00
ulong agentId ,
2019-12-16 17:05:26 -05:00
string currentState ,
2021-11-22 18:27:57 -05:00
string updateTrace ,
2019-10-10 00:52:42 -04:00
object userState = null ,
CancellationToken cancellationToken = default )
{
2019-12-16 17:05:26 -05:00
HttpMethod httpMethod = new HttpMethod ( "PUT" ) ;
Guid locationId = new Guid ( "8cc1b02b-ae49-4516-b5ad-4f9b29967c30" ) ;
object routeValues = new { poolId = poolId , agentId = agentId } ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
List < KeyValuePair < string , string > > queryParams = new List < KeyValuePair < string , string > > ( ) ;
queryParams . Add ( "currentState" , currentState ) ;
2021-11-22 18:27:57 -05:00
queryParams . Add ( "updateTrace" , updateTrace ) ;
2019-10-10 00:52:42 -04:00
2019-12-16 17:05:26 -05:00
return SendAsync < TaskAgent > (
2019-10-10 00:52:42 -04:00
httpMethod ,
locationId ,
2019-12-16 17:05:26 -05:00
routeValues : routeValues ,
2019-10-10 00:52:42 -04:00
version : new ApiResourceVersion ( 5.1 , 1 ) ,
2019-12-16 17:05:26 -05:00
queryParameters : queryParams ,
2019-10-10 00:52:42 -04:00
userState : userState ,
cancellationToken : cancellationToken ) ;
}
}
}