private async Task <IEnumerable <Agent> > GetAllAgentsForInstance(TaskAgentHttpClient client, ILogger logger) { IEnumerable <Agent> allAgents = new List <Agent>(); var pools = await client.GetAgentPoolsAsync(); foreach (var p in pools.Where(x => x.IsHosted == false)) { var agentsInPool = await client.GetAgentsAsync(p.Id, includeCapabilities : true); var convertedAgents = agentsInPool.Select(x => new Agent(x, p.Id)); allAgents = allAgents.Concat(convertedAgents); } return(allAgents); }
//----------------------------------------------------------------- // Configuration //----------------------------------------------------------------- public Task <List <TaskAgentPool> > GetAgentPoolsAsync(string agentPoolName, TaskAgentPoolType poolType = TaskAgentPoolType.Automation) { CheckConnection(); return(_taskAgentClient.GetAgentPoolsAsync(agentPoolName, poolType: poolType)); }
//----------------------------------------------------------------- // Configuration //----------------------------------------------------------------- public Task <List <TaskAgentPool> > GetAgentPoolsAsync(string agentPoolName = null, TaskAgentPoolType poolType = TaskAgentPoolType.Automation) { CheckConnection(RunnerConnectionType.Generic); return(_genericTaskAgentClient.GetAgentPoolsAsync(agentPoolName, poolType: poolType)); }
//----------------------------------------------------------------- // Configuration //----------------------------------------------------------------- public Task <List <TaskAgentPool> > GetAgentPoolsAsync(string agentPoolName) { CheckConnection(); return(_taskAgentClient.GetAgentPoolsAsync(agentPoolName)); }