use of jetbrains.buildServer.serverSide.agentPools.AgentPool in project teamcity-rest by JetBrains.
the class ProjectResolver method projectAgentPool.
@Nullable
public ProjectAgentPool projectAgentPool(@NotNull Project source, @NotNull DataFetchingEnvironment env) {
SProject self = source.getRealProject();
AgentPool pool = myAgentPoolManager.findProjectPoolByProjectId(self.getProjectId());
if (pool == null)
return null;
return new ProjectAgentPool(pool);
}
use of jetbrains.buildServer.serverSide.agentPools.AgentPool in project teamcity-rest by JetBrains.
the class Build method getAgent.
@XmlElement(name = "agent")
public Agent getAgent() {
return ValueWithDefault.decideDefault(myFields.isIncluded("agent", false), () -> {
if (myBuild != null) {
if (myBuild.isAgentLessBuild())
return null;
SBuildAgent agent = myBuild.getAgent();
return new Agent(agent, myFields.getNestedField("agent"), myBeanContext);
}
if (myQueuedBuild != null) {
final AgentRestrictor agentRestrictor = myQueuedBuild.getAgentRestrictor();
if (agentRestrictor != null) {
if (agentRestrictor.getType() == AgentRestrictorType.SINGLE_AGENT) {
SBuildAgent agent = myQueuedBuild.getBuildAgent();
if (agent != null) {
return new Agent(agent, myFields.getNestedField("agent"), myBeanContext);
}
}
if (agentRestrictor.getType() == AgentRestrictorType.AGENT_POOL) {
final int agentPoolId = agentRestrictor.getId();
final AgentPool agentPool = myBeanContext.getSingletonService(AgentPoolFinder.class).getAgentPoolById(agentPoolId);
return new Agent(agentPool, myFields.getNestedField("agent"), myBeanContext);
}
if (agentRestrictor.getType() == AgentRestrictorType.CLOUD_IMAGE) {
final int agentTypeId = agentRestrictor.getId();
final SAgentType agentType = AgentFinder.getAgentType(String.valueOf(agentTypeId), myBeanContext.getSingletonService(AgentTypeFinder.class));
return new Agent(agentType, myFields.getNestedField("agent"), myBeanContext);
}
}
}
return null;
});
}
Aggregations