Java Code Examples for com.thoughtworks.go.plugin.api.response.DefaultGoApiResponse#error()
The following examples show how to use
com.thoughtworks.go.plugin.api.response.DefaultGoApiResponse#error() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorizationRequestProcessor.java From gocd with Apache License 2.0 | 5 votes |
@Override public GoApiResponse process(GoPluginDescriptor pluginDescriptor, GoApiRequest request) { validatePluginRequest(request); switch (Request.fromString(request.api())) { case INVALIDATE_CACHE_REQUEST: return processInvalidateCacheRequest(pluginDescriptor); default: return DefaultGoApiResponse.error("Illegal api request"); } }
Example 2
Source File: ElasticAgentRequestProcessorV1.java From gocd with Apache License 2.0 | 5 votes |
@Override public GoApiResponse process(final GoPluginDescriptor pluginDescriptor, GoApiRequest goPluginApiRequest) { switch (goPluginApiRequest.api()) { case REQUEST_DISABLE_AGENTS: return processDisableAgent(pluginDescriptor, goPluginApiRequest); case REQUEST_DELETE_AGENTS: return processDeleteAgent(pluginDescriptor, goPluginApiRequest); case REQUEST_SERVER_LIST_AGENTS: return processListAgents(pluginDescriptor, goPluginApiRequest); default: return DefaultGoApiResponse.error("Illegal api request"); } }
Example 3
Source File: ArtifactRequestProcessor.java From gocd with Apache License 2.0 | 5 votes |
@Override public GoApiResponse process(GoPluginDescriptor pluginDescriptor, GoApiRequest request) { validatePluginRequest(request); switch (Request.fromString(request.api())) { case CONSOLE_LOG: return processConsoleLogRequest(pluginDescriptor, request); default: return DefaultGoApiResponse.error("Illegal api request"); } }
Example 4
Source File: ArtifactRequestProcessor.java From gocd with Apache License 2.0 | 5 votes |
private GoApiResponse processConsoleLogRequest(GoPluginDescriptor pluginDescriptor, GoApiRequest request) { final ConsoleLogMessage consoleLogMessage = ConsoleLogMessage.fromJSON(request.requestBody()); final String message = format("[%s] %s", pluginDescriptor.id(), consoleLogMessage.getMessage()); Optional<String> parsedTag = parseTag(processType, consoleLogMessage.getLogLevel()); if (parsedTag.isPresent()) { safeOutputStreamConsumer.taggedStdOutput(parsedTag.get(), message); return DefaultGoApiResponse.success(null); } return DefaultGoApiResponse.error(format("Unsupported log level `%s`.", consoleLogMessage.getLogLevel())); }