Search in sources :

Example 16 with EntityNotFoundGraphQLError

use of jetbrains.buildServer.server.graphql.util.EntityNotFoundGraphQLError in project teamcity-rest by JetBrains.

the class CloudImageResolver method agentTypeRawId.

@NotNull
public DataFetcherResult<Integer> agentTypeRawId(@NotNull CloudImage image, @NotNull DataFetchingEnvironment env) {
    DataFetcherResult.Builder<Integer> result = DataFetcherResult.newResult();
    AgentType agentType = findAgentType(image);
    if (agentType == null) {
        return result.error(new EntityNotFoundGraphQLError(String.format("Agent type for image id=%s is no found.", image.getRawId()))).build();
    }
    return result.data(agentType.getAgentTypeId()).build();
}
Also used : AgentType(jetbrains.buildServer.serverSide.agentTypes.AgentType) DataFetcherResult(graphql.execution.DataFetcherResult) EntityNotFoundGraphQLError(jetbrains.buildServer.server.graphql.util.EntityNotFoundGraphQLError) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DataFetcherResult (graphql.execution.DataFetcherResult)16 EntityNotFoundGraphQLError (jetbrains.buildServer.server.graphql.util.EntityNotFoundGraphQLError)16 NotNull (org.jetbrains.annotations.NotNull)16 Used (jetbrains.buildServer.Used)13 OperationFailedGraphQLError (jetbrains.buildServer.server.graphql.util.OperationFailedGraphQLError)11 jetbrains.buildServer.server.graphql.model.mutation.agentPool (jetbrains.buildServer.server.graphql.model.mutation.agentPool)7 UnexpectedServerGraphQLError (jetbrains.buildServer.server.graphql.util.UnexpectedServerGraphQLError)6 CloudClientEx (jetbrains.buildServer.clouds.CloudClientEx)4 CloudProfile (jetbrains.buildServer.clouds.CloudProfile)4 Agent (jetbrains.buildServer.server.graphql.model.Agent)4 CloudImage (jetbrains.buildServer.server.graphql.model.CloudImage)4 Pair (com.intellij.openapi.util.Pair)3 Project (jetbrains.buildServer.server.graphql.model.Project)3 AbstractAgentPool (jetbrains.buildServer.server.graphql.model.agentPool.AbstractAgentPool)3 AuthorityHolder (jetbrains.buildServer.serverSide.auth.AuthorityHolder)3 Logger (com.intellij.openapi.diagnostic.Logger)2 GraphQLMutationResolver (graphql.kickstart.tools.GraphQLMutationResolver)2 DataFetchingEnvironment (graphql.schema.DataFetchingEnvironment)2 java.util (java.util)2 Collectors (java.util.stream.Collectors)2