diff --git a/src/main/java/org/rundeck/api/RundeckClient.java b/src/main/java/org/rundeck/api/RundeckClient.java index 28bf88b..f705c48 100644 --- a/src/main/java/org/rundeck/api/RundeckClient.java +++ b/src/main/java/org/rundeck/api/RundeckClient.java @@ -3265,11 +3265,119 @@ public class RundeckClient implements Serializable { public RundeckOutput getJobExecutionOutput(Long executionId, int offset, int lastlines, long lastmod, int maxlines) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); - return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output.xml").param("offset", offset) - .param("lastlines", lastlines) - .param("lastmod", lastmod) - .param("maxlines", maxlines), - new OutputParser("result/output", createOutputEntryParser())); + return new ApiCall(this).get(new ApiPathBuilder( + "/execution/", executionId.toString(), + "/output") + .param("offset", offset) + .param("lastlines", lastlines) + .param("lastmod", lastmod) + .param("maxlines", maxlines), + new OutputParser("result/output", createOutputEntryParser())); + } + + /** + * Get the execution output of the given execution on the specified node + * + * @param executionId identifier of the execution - mandatory + * @param nodeName name of the node + * @param offset byte offset to read from in the file. 0 indicates the beginning. + * @param lastlines nnumber of lines to retrieve from the end of the available output. If specified it will + * override the offset value and return only the specified number of lines at the end of the + * log. + * @param lastmod epoch datestamp in milliseconds, return results only if modification changed since the + * specified date OR if more data is available at the given offset + * @param maxlines maximum number of lines to retrieve forward from the specified offset. + * + * @return {@link RundeckOutput} + * + * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) + * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) + * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) + * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) + */ + public RundeckOutput getJobExecutionOutputForNode(Long executionId, String nodeName, int offset, int lastlines, + long lastmod, int maxlines) + throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { + AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); + AssertUtil.notNull(nodeName, "nodeName is mandatory to get the output of a job execution!"); + return new ApiCall(this).get(new ApiPathBuilder( + "/execution/", executionId.toString(), + "/output/node/", nodeName ) + .param("offset", offset) + .param("lastlines", lastlines) + .param("lastmod", lastmod) + .param("maxlines", maxlines), + new OutputParser("result/output", createOutputEntryParser())); + } + /** + * Get the execution output of the given execution for the specified step + * + * @param executionId identifier of the execution - mandatory + * @param stepCtx identifier for the step + * @param offset byte offset to read from in the file. 0 indicates the beginning. + * @param lastlines nnumber of lines to retrieve from the end of the available output. If specified it will + * override the offset value and return only the specified number of lines at the end of the + * log. + * @param lastmod epoch datestamp in milliseconds, return results only if modification changed since the + * specified date OR if more data is available at the given offset + * @param maxlines maximum number of lines to retrieve forward from the specified offset. + * + * @return {@link RundeckOutput} + * + * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) + * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) + * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) + * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) + */ + public RundeckOutput getJobExecutionOutputForStep(Long executionId, String stepCtx, int offset, int lastlines, + long lastmod, int maxlines) + throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { + AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); + AssertUtil.notNull(stepCtx, "stepCtx is mandatory to get the output of a job execution!"); + return new ApiCall(this).get(new ApiPathBuilder( + "/execution/", executionId.toString(), + "/output/step/", stepCtx) + .param("offset", offset) + .param("lastlines", lastlines) + .param("lastmod", lastmod) + .param("maxlines", maxlines), + new OutputParser("result/output", createOutputEntryParser())); + } + /** + * Get the execution output of the given execution for the specified step + * + * @param executionId identifier of the execution - mandatory + * @param stepCtx identifier for the step + * @param offset byte offset to read from in the file. 0 indicates the beginning. + * @param lastlines nnumber of lines to retrieve from the end of the available output. If specified it will + * override the offset value and return only the specified number of lines at the end of the + * log. + * @param lastmod epoch datestamp in milliseconds, return results only if modification changed since the + * specified date OR if more data is available at the given offset + * @param maxlines maximum number of lines to retrieve forward from the specified offset. + * + * @return {@link RundeckOutput} + * + * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) + * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) + * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) + * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) + */ + public RundeckOutput getJobExecutionOutputForNodeAndStep(Long executionId, String nodeName, String stepCtx, int offset, int lastlines, + long lastmod, int maxlines) + throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { + AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); + AssertUtil.notNull(nodeName, "nodeName is mandatory to get the output of a job execution!"); + AssertUtil.notNull(stepCtx, "stepCtx is mandatory to get the output of a job execution!"); + return new ApiCall(this).get(new ApiPathBuilder( + "/execution/", executionId.toString(), + "/output/node/", nodeName, + "/step/", stepCtx) + .param("offset", offset) + .param("lastlines", lastlines) + .param("lastmod", lastmod) + .param("maxlines", maxlines), + new OutputParser("result/output", createOutputEntryParser())); } @@ -3289,7 +3397,7 @@ public class RundeckClient implements Serializable { public RundeckOutput getJobExecutionOutput(Long executionId, int offset, long lastmod, int maxlines) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); - return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output.xml").param("offset", offset) + return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output").param("offset", offset) .param("lastmod", lastmod) .param("maxlines", maxlines), new OutputParser("result/output", createOutputEntryParser()));