public JobAssignedEvent( Guid jobId, TaskAgentJobRequest request) : base(JobEventTypes.JobAssigned, jobId) { this.Request = request; }
public virtual Task <TaskAgentJobRequest> UpdateAgentRequestAsync( int poolId, long requestId, Guid lockToken, TaskAgentJobRequest request, object userState = null, CancellationToken cancellationToken = default) { 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()); return(SendAsync <TaskAgentJobRequest>( httpMethod, locationId, routeValues: routeValues, version: new ApiResourceVersion(5.1, 1), queryParameters: queryParams, userState: userState, cancellationToken: cancellationToken, content: content)); }
private TaskAgentJobRequest(TaskAgentJobRequest requestToBeCloned) { this.RequestId = requestToBeCloned.RequestId; this.QueueTime = requestToBeCloned.QueueTime; this.AssignTime = requestToBeCloned.AssignTime; this.ReceiveTime = requestToBeCloned.ReceiveTime; this.FinishTime = requestToBeCloned.FinishTime; this.Result = requestToBeCloned.Result; this.LockedUntil = requestToBeCloned.LockedUntil; this.ServiceOwner = requestToBeCloned.ServiceOwner; this.HostId = requestToBeCloned.HostId; this.ScopeId = requestToBeCloned.ScopeId; this.PlanType = requestToBeCloned.PlanType; this.PlanGroup = requestToBeCloned.PlanGroup; this.PlanId = requestToBeCloned.PlanId; this.QueueId = requestToBeCloned.QueueId; this.PoolId = requestToBeCloned.PoolId; this.JobId = requestToBeCloned.JobId; this.JobName = requestToBeCloned.JobName; this.LockToken = requestToBeCloned.LockToken; this.ExpectedDuration = requestToBeCloned.ExpectedDuration; this.OrchestrationId = requestToBeCloned.OrchestrationId; this.MatchesAllAgentsInPool = requestToBeCloned.MatchesAllAgentsInPool; if (requestToBeCloned.m_matchedAgents != null && requestToBeCloned.m_matchedAgents.Count > 0) { m_matchedAgents = requestToBeCloned.m_matchedAgents.Select(x => x.Clone()).ToList(); } if (requestToBeCloned.ReservedAgent != null) { this.ReservedAgent = requestToBeCloned.ReservedAgent.Clone(); } if (requestToBeCloned.m_requestAgentData?.Count > 0) { foreach (var pair in requestToBeCloned.m_requestAgentData) { this.Data[pair.Key] = pair.Value; } } if (requestToBeCloned.AgentSpecification != null) { this.AgentSpecification = new JObject(requestToBeCloned.AgentSpecification); } if (requestToBeCloned.Labels != null) { this.Labels = new HashSet <string>(requestToBeCloned.Labels, StringComparer.OrdinalIgnoreCase); } }
public Task <TaskAgentJobRequest> RenewAgentRequestAsync( Int32 poolId, Int64 requestId, Guid lockToken, DateTime?expiresOn = null, Object userState = null, CancellationToken cancellationToken = default(CancellationToken)) { var request = new TaskAgentJobRequest { RequestId = requestId, LockedUntil = expiresOn, }; return(UpdateAgentRequestAsync(poolId, requestId, lockToken, request, userState, cancellationToken)); }
public Task <TaskAgentJobRequest> FinishAgentRequestAsync( Int32 poolId, Int64 requestId, Guid lockToken, DateTime finishTime, TaskResult result, Object userState = null, CancellationToken cancellationToken = default(CancellationToken)) { var request = new TaskAgentJobRequest { RequestId = requestId, FinishTime = finishTime, Result = result, }; return(UpdateAgentRequestAsync(poolId, requestId, lockToken, request, userState, cancellationToken)); }
public Task <TaskAgentJobRequest> RenewAgentRequestAsync( Int32 poolId, Int64 requestId, Guid lockToken, DateTime?expiresOn = null, string orchestrationId = null, Object userState = null, CancellationToken cancellationToken = default(CancellationToken)) { var request = new TaskAgentJobRequest { RequestId = requestId, LockedUntil = expiresOn, }; var additionalHeaders = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(orchestrationId)) { additionalHeaders["X-VSS-OrchestrationId"] = orchestrationId; } 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()); return(SendAsync <TaskAgentJobRequest>( httpMethod, additionalHeaders, locationId, routeValues: routeValues, version: new ApiResourceVersion(5.1, 1), queryParameters: queryParams, userState: userState, cancellationToken: cancellationToken, content: content)); }