use of jetbrains.buildServer.server.graphql.model.agentPool.ProjectAgentPool in project teamcity-rest by JetBrains.
the class ProjectAgentPoolResolver method project.
@NotNull
public Project project(@NotNull ProjectAgentPool pool, @NotNull DataFetchingEnvironment env) {
AgentPool realPool = pool.getRealPool();
if (!realPool.isProjectPool()) {
throw new RuntimeException(String.format("Pool id=%d is not a project pool.", realPool.getAgentPoolId()));
}
String projectId = ((ProjectAgentPoolImpl) realPool).getProjectId();
SProject project = myProjectManager.findProjectById(projectId);
if (project == null) {
throw new RuntimeException(String.format("ProjectAgentPool id=%d does not have a project.", realPool.getAgentPoolId()));
}
return new Project(project);
}
use of jetbrains.buildServer.server.graphql.model.agentPool.ProjectAgentPool in project teamcity-rest by JetBrains.
the class CloudImageResolver method agentPool.
@NotNull
public DataFetcherResult<AbstractAgentPool> agentPool(@NotNull CloudImage image, @NotNull DataFetchingEnvironment env) {
DataFetcherResult.Builder<AbstractAgentPool> result = new DataFetcherResult.Builder<>();
AgentType agentType = findAgentType(image);
AgentPool pool = agentType != null ? myAgentPoolManager.findAgentPoolById(agentType.getAgentPoolId()) : null;
if (agentType == null || pool == null) {
result.error(new EntityNotFoundGraphQLError(String.format("Could not find agent pool for image id=%s in profile id=%s", image.getRawId(), image.getProfileId())));
return result.build();
}
return result.data(new ProjectAgentPool(pool)).localContext(pool).build();
}
use of jetbrains.buildServer.server.graphql.model.agentPool.ProjectAgentPool 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);
}
Aggregations