diff --git a/apidocs/assets/navtree_data.js b/apidocs/assets/navtree_data.js index 7d6ebe1..806b495 100644 --- a/apidocs/assets/navtree_data.js +++ b/apidocs/assets/navtree_data.js @@ -5,7 +5,7 @@ var NAVTREE_DATA = , "" ], [ "Exceptions", null, [ [ "RundeckApiException", "org/rundeck/api/RundeckApiException.html", null, "" ], [ "RundeckApiException.RundeckApiAuthException", "org/rundeck/api/RundeckApiException.RundeckApiAuthException.html", null, "" ], [ "RundeckApiException.RundeckApiLoginException", "org/rundeck/api/RundeckApiException.RundeckApiLoginException.html", null, "" ], [ "RundeckApiException.RundeckApiTokenException", "org/rundeck/api/RundeckApiException.RundeckApiTokenException.html", null, "" ] ] , "" ] ] , "" ], [ "org.rundeck.api.domain", "org/rundeck/api/domain/package-summary.html", [ [ "Description", "org/rundeck/api/domain/package-descr.html", null, "" ], [ "Classes", null, [ [ "RundeckAbort", "org/rundeck/api/domain/RundeckAbort.html", null, "" ], [ "RundeckEvent", "org/rundeck/api/domain/RundeckEvent.html", null, "" ], [ "RundeckEvent.NodeSummary", "org/rundeck/api/domain/RundeckEvent.NodeSummary.html", null, "" ], [ "RundeckExecution", "org/rundeck/api/domain/RundeckExecution.html", null, "" ], [ "RundeckHistory", "org/rundeck/api/domain/RundeckHistory.html", null, "" ], [ "RundeckJob", "org/rundeck/api/domain/RundeckJob.html", null, "" ], [ "RundeckJobDelete", "org/rundeck/api/domain/RundeckJobDelete.html", null, "" ], [ "RundeckJobDeleteBulk", "org/rundeck/api/domain/RundeckJobDeleteBulk.html", null, "" ], [ "RundeckJobsImportResult", "org/rundeck/api/domain/RundeckJobsImportResult.html", null, "" ], [ "RundeckNode", "org/rundeck/api/domain/RundeckNode.html", null, "" ], [ "RundeckOutput", "org/rundeck/api/domain/RundeckOutput.html", null, "" ], [ "RundeckOutputEntry", "org/rundeck/api/domain/RundeckOutputEntry.html", null, "" ], [ "RundeckProject", "org/rundeck/api/domain/RundeckProject.html", null, "" ], [ "RundeckSystemInfo", "org/rundeck/api/domain/RundeckSystemInfo.html", null, "" ] ] -, "" ], [ "Enums", null, [ [ "RundeckAbort.AbortStatus", "org/rundeck/api/domain/RundeckAbort.AbortStatus.html", null, "" ], [ "RundeckEvent.EventStatus", "org/rundeck/api/domain/RundeckEvent.EventStatus.html", null, "" ], [ "RundeckExecution.ExecutionStatus", "org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html", null, "" ], [ "RundeckJobsImportMethod", "org/rundeck/api/domain/RundeckJobsImportMethod.html", null, "" ], [ "RundeckOutputEntry.RundeckLogLevel", "org/rundeck/api/domain/RundeckOutputEntry.RundeckLogLevel.html", null, "" ] ] +, "" ], [ "Enums", null, [ [ "RundeckAbort.AbortStatus", "org/rundeck/api/domain/RundeckAbort.AbortStatus.html", null, "" ], [ "RundeckEvent.EventStatus", "org/rundeck/api/domain/RundeckEvent.EventStatus.html", null, "" ], [ "RundeckExecution.ExecutionStatus", "org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html", null, "" ], [ "RundeckJobsImportMethod", "org/rundeck/api/domain/RundeckJobsImportMethod.html", null, "" ], [ "RundeckJobsUUIDImportBehavior", "org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html", null, "" ], [ "RundeckOutputEntry.RundeckLogLevel", "org/rundeck/api/domain/RundeckOutputEntry.RundeckLogLevel.html", null, "" ] ] , "" ] ] , "" ], [ "org.rundeck.api.parser", "org/rundeck/api/parser/package-summary.html", [ [ "Description", "org/rundeck/api/parser/package-descr.html", null, "" ], [ "Interfaces", null, [ [ "XmlNodeParser", "org/rundeck/api/parser/XmlNodeParser.html", null, "" ] ] , "" ], [ "Classes", null, [ [ "AbortParser", "org/rundeck/api/parser/AbortParser.html", null, "" ], [ "BulkDeleteParser", "org/rundeck/api/parser/BulkDeleteParser.html", null, "" ], [ "DeleteParser", "org/rundeck/api/parser/DeleteParser.html", null, "" ], [ "EventParser", "org/rundeck/api/parser/EventParser.html", null, "" ], [ "ExecutionParser", "org/rundeck/api/parser/ExecutionParser.html", null, "" ], [ "HistoryParser", "org/rundeck/api/parser/HistoryParser.html", null, "" ], [ "JobParser", "org/rundeck/api/parser/JobParser.html", null, "" ], [ "JobsImportResultParser", "org/rundeck/api/parser/JobsImportResultParser.html", null, "" ], [ "ListParser", "org/rundeck/api/parser/ListParser.html", null, "" ], [ "NodeParser", "org/rundeck/api/parser/NodeParser.html", null, "" ], [ "OutputEntryParser", "org/rundeck/api/parser/OutputEntryParser.html", null, "" ], [ "OutputEntryParserV5", "org/rundeck/api/parser/OutputEntryParserV5.html", null, "" ], [ "OutputParser", "org/rundeck/api/parser/OutputParser.html", null, "" ], [ "PagedResultParser", "org/rundeck/api/parser/PagedResultParser.html", null, "" ], [ "ParserHelper", "org/rundeck/api/parser/ParserHelper.html", null, "" ], [ "ProjectParser", "org/rundeck/api/parser/ProjectParser.html", null, "" ], [ "StringParser", "org/rundeck/api/parser/StringParser.html", null, "" ], [ "SystemInfoParser", "org/rundeck/api/parser/SystemInfoParser.html", null, "" ] ] diff --git a/apidocs/proof-read.txt b/apidocs/proof-read.txt index ad559bb..1085dd9 100644 --- a/apidocs/proof-read.txt +++ b/apidocs/proof-read.txt @@ -66,6 +66,7 @@ METHOD: setFileType METHOD: setJobsImportMethod METHOD: setProject METHOD: setStream +METHOD: setUUIDImportBehavior === org/rundeck/api/RundeckJobsImport.html === @@ -78,6 +79,8 @@ METHOD: getProject Return the project name METHOD: getStream Return the input stream +METHOD: getUuidImportBehavior + Return the import behavior === org/rundeck/api/RundeckClientBuilder.html === @@ -575,6 +578,7 @@ ENUM: V5 ENUM: V6 ENUM: V7 ENUM: V8 +ENUM: V9 METHOD: getVersionNumber METHOD: valueOf METHOD: values @@ -747,10 +751,12 @@ METHOD: getFileType METHOD: getImportMethod METHOD: getProject METHOD: getStream +METHOD: getUuidImportBehavior METHOD: setFileType METHOD: setImportMethod METHOD: setProject METHOD: setStream +METHOD: setUuidImportBehavior === org/rundeck/api/domain/RundeckSystemInfo.html === @@ -911,6 +917,14 @@ METHOD: setUsername METHOD: toString +=== org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html === + $INTERFACE is ... User: greg Date: 1/16/14 Time: 11:38 AM +ENUM: PRESERVE +ENUM: REMOVE +METHOD: valueOf +METHOD: values + + === org/rundeck/api/domain/RundeckJobsImportResult.html === Result of importing some jobs into RunDeck CONSTRUCTOR: RundeckJobsImportResult @@ -1028,6 +1042,7 @@ METHOD: getDurationInSeconds METHOD: getEndedAt METHOD: getId METHOD: getJob +METHOD: getProject METHOD: getShortDuration METHOD: getStartedAt METHOD: getStartedBy @@ -1040,6 +1055,7 @@ METHOD: setDescription METHOD: setEndedAt METHOD: setId METHOD: setJob +METHOD: setProject METHOD: setStartedAt METHOD: setStartedBy METHOD: setStatus diff --git a/apidocs/reference/classes.html b/apidocs/reference/classes.html index 8e636a0..27d1a0a 100644 --- a/apidocs/reference/classes.html +++ b/apidocs/reference/classes.html @@ -629,12 +629,18 @@ + RundeckJobsUUIDImportBehavior + $INTERFACE is ...  + + + + RundeckNode Represents a RunDeck node (server on which RunDeck can execute jobs and commands)  - + RundeckOutput Represents a RunDeck output @@ -642,7 +648,7 @@ - + RundeckOutputEntry Represents a RunDeck output entry @@ -650,32 +656,32 @@ - + RundeckOutputEntry.RundeckLogLevel   - + RundeckProject Represents a RunDeck project  - + RundeckSystemInfo Represents the RunDeck system info  - + RunJob Job run request   - + RunJobBuilder Job run request builder   diff --git a/apidocs/reference/current.xml b/apidocs/reference/current.xml index c2a8790..8a8600c 100644 --- a/apidocs/reference/current.xml +++ b/apidocs/reference/current.xml @@ -63,6 +63,17 @@ visibility="public" > + + + + + + + + + + + + + + + + + + + + + + + + + + + RundeckJobsUUIDImportBehavior - setFileType(FileType fileType) + getUuidImportBehavior() +
Return the import behavior
+ @@ -535,7 +537,7 @@ Summary: void - setImportMethod(RundeckJobsImportMethod importMethod) + setFileType(FileType fileType) @@ -551,7 +553,7 @@ Summary: void - setProject(String project) + setImportMethod(RundeckJobsImportMethod importMethod) @@ -564,6 +566,22 @@ Summary: + void + + + setProject(String project) + + + + + + + + + + + + void @@ -572,6 +590,22 @@ Summary: + + + + + + + + + void + + + setUuidImportBehavior(RundeckJobsUUIDImportBehavior uuidImportBehavior) + + + + @@ -880,6 +914,24 @@ From interface + + + + abstract + + + + + RundeckJobsUUIDImportBehavior + + + getUuidImportBehavior() + +
Return the import behavior
+ + + + @@ -1090,6 +1142,37 @@ From interface + + +
+

+ + public + + + + + RundeckJobsUUIDImportBehavior + + getUuidImportBehavior + () +

+
+
+ +
+ + + +
+
+ +

Return the import behavior

+ +
+
+ +
@@ -1214,6 +1297,37 @@ From interface
+ + +
+

+ + public + + + + + void + + setUuidImportBehavior + (RundeckJobsUUIDImportBehavior uuidImportBehavior) +

+
+
+ +
+ + + +
+
+ +

+ +
+
+ + diff --git a/apidocs/reference/org/rundeck/api/RundeckClient.Version.html b/apidocs/reference/org/rundeck/api/RundeckClient.Version.html index b61ad75..4d757b2 100644 --- a/apidocs/reference/org/rundeck/api/RundeckClient.Version.html +++ b/apidocs/reference/org/rundeck/api/RundeckClient.Version.html @@ -443,6 +443,13 @@ Summary: + + RundeckClient.Version  + V9  +   + + + @@ -1111,6 +1118,36 @@ From interface + +
+ +

+ + +
+ + + + + + +
+

+ + public + static + final + RundeckClient.Version + + V9 +

+
+ + + + + +
diff --git a/apidocs/reference/org/rundeck/api/RundeckJobsImport.html b/apidocs/reference/org/rundeck/api/RundeckJobsImport.html index b5b76a1..909f5f9 100644 --- a/apidocs/reference/org/rundeck/api/RundeckJobsImport.html +++ b/apidocs/reference/org/rundeck/api/RundeckJobsImport.html @@ -476,6 +476,24 @@ Summary: + + + + abstract + + + + + RundeckJobsUUIDImportBehavior + + + getUuidImportBehavior() + +
Return the import behavior
+ + + + @@ -648,6 +666,37 @@ Summary:
+ + +
+

+ + public + + + abstract + + RundeckJobsUUIDImportBehavior + + getUuidImportBehavior + () +

+
+
+ +
+ + + +
+
+ +

Return the import behavior

+ +
+
+ + diff --git a/apidocs/reference/org/rundeck/api/RundeckJobsImportBuilder.html b/apidocs/reference/org/rundeck/api/RundeckJobsImportBuilder.html index bf3e367..36820be 100644 --- a/apidocs/reference/org/rundeck/api/RundeckJobsImportBuilder.html +++ b/apidocs/reference/org/rundeck/api/RundeckJobsImportBuilder.html @@ -556,6 +556,22 @@ Summary: + + + + + + + + + RundeckJobsImportBuilder + + + setUUIDImportBehavior(RundeckJobsUUIDImportBehavior behavior) + + + + @@ -1100,6 +1116,37 @@ From class
+ + +
+

+ + public + + + + + RundeckJobsImportBuilder + + setUUIDImportBehavior + (RundeckJobsUUIDImportBehavior behavior) +

+
+
+ +
+ + + +
+
+ +

+ +
+
+ + diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckAbort.AbortStatus.html b/apidocs/reference/org/rundeck/api/domain/RundeckAbort.AbortStatus.html index 5b432d6..ae5677e 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckAbort.AbortStatus.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckAbort.AbortStatus.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckAbort.html b/apidocs/reference/org/rundeck/api/domain/RundeckAbort.html index 488bdbb..0123312 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckAbort.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckAbort.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckEvent.EventStatus.html b/apidocs/reference/org/rundeck/api/domain/RundeckEvent.EventStatus.html index 2db9539..fded4dc 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckEvent.EventStatus.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckEvent.EventStatus.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckEvent.NodeSummary.html b/apidocs/reference/org/rundeck/api/domain/RundeckEvent.NodeSummary.html index d07bb02..9ec4378 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckEvent.NodeSummary.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckEvent.NodeSummary.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckEvent.html b/apidocs/reference/org/rundeck/api/domain/RundeckEvent.html index 63afab9..a595d95 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckEvent.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckEvent.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html b/apidocs/reference/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html index 21d7877..d7026c7 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckExecution.html b/apidocs/reference/org/rundeck/api/domain/RundeckExecution.html index 2bdbe2b..2e95cb2 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckExecution.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckExecution.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • @@ -623,7 +624,7 @@ Summary: String - getShortDuration() + getProject() @@ -636,6 +637,22 @@ Summary: + String + + + getShortDuration() + + + + + + + + + + + + Date @@ -645,7 +662,7 @@ Summary: - + @@ -661,7 +678,7 @@ Summary: - + @@ -677,7 +694,7 @@ Summary: - + @@ -693,7 +710,7 @@ Summary: - + @@ -709,7 +726,7 @@ Summary: - + @@ -725,7 +742,7 @@ Summary: - + @@ -741,7 +758,7 @@ Summary: - + @@ -757,7 +774,7 @@ Summary: - + @@ -773,7 +790,7 @@ Summary: - + @@ -789,7 +806,7 @@ Summary: - + @@ -805,6 +822,22 @@ Summary: + + + + + + + + void + + + setProject(String project) + + + + + @@ -1516,6 +1549,37 @@ From class + + +
    +

    + + public + + + + + String + + getProject + () +

    +
    +
    + +
    + + + +
    +
    + +

    + +
    +
    + +
    @@ -1899,6 +1963,37 @@ From class
    + + +
    +

    + + public + + + + + void + + setProject + (String project) +

    +
    +
    + +
    + + + +
    +
    + +

    + +
    +
    + +
    diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckHistory.html b/apidocs/reference/org/rundeck/api/domain/RundeckHistory.html index af7b328..25baaf8 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckHistory.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckHistory.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckJob.html b/apidocs/reference/org/rundeck/api/domain/RundeckJob.html index c00ccf0..9824323 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckJob.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckJob.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckJobDelete.html b/apidocs/reference/org/rundeck/api/domain/RundeckJobDelete.html index dff734e..47502f5 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckJobDelete.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckJobDelete.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckJobDeleteBulk.html b/apidocs/reference/org/rundeck/api/domain/RundeckJobDeleteBulk.html index 44573cc..0e9e1cb 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckJobDeleteBulk.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckJobDeleteBulk.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportMethod.html b/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportMethod.html index 6eeedcb..be8f729 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportMethod.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportMethod.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportResult.html b/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportResult.html index f879e27..3e83506 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportResult.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckJobsImportResult.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html b/apidocs/reference/org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html new file mode 100644 index 0000000..05daf30 --- /dev/null +++ b/apidocs/reference/org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html @@ -0,0 +1,1137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RundeckJobsUUIDImportBehavior + + +| RunDeck API - Java Client + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    +
    + + + + +
    + public + + final + + enum +

    RundeckJobsUUIDImportBehavior

    + + + + + + + + + extends Enum<E extends Enum<E>>
    + + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    java.lang.Object
       ↳java.lang.Enum<E extends java.lang.Enum<E>>
        ↳org.rundeck.api.domain.RundeckJobsUUIDImportBehavior
    + + + + + + + +
    + + +

    Class Overview

    +

    $INTERFACE is ... User: greg Date: 1/16/14 Time: 11:38 AM +

    + + + + + +
    + + + + + + + + + + + + + + + + +
    + + +

    Summary

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Enum Values
    RundeckJobsUUIDImportBehavior PRESERVE  
    RundeckJobsUUIDImportBehavior REMOVE  
    + + + + + + + + + + + + + + + + +
    Public Methods
    + + + + static + + RundeckJobsUUIDImportBehavior + + valueOf(String name) + +
    + + + final + static + + RundeckJobsUUIDImportBehavior[] + + values() + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + [Expand] +
    Inherited Methods
    + +From class + + java.lang.Enum + +
    + + +
    +
    + +From class + + java.lang.Object + +
    + + +
    +
    + +From interface + + java.lang.Comparable + +
    + + +
    +
    + + +
    + + + + + + + + + + + + + + + + + +

    Enum Values

    + + + + + + +
    +

    + + public + static + final + RundeckJobsUUIDImportBehavior + + PRESERVE +

    +
    + + + + + + +
    +
    + +

    + + +
    +
    + + + + + +
    +

    + + public + static + final + RundeckJobsUUIDImportBehavior + + REMOVE +

    +
    + + + + + + +
    +
    + +

    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + +

    Public Methods

    + + + + + +
    +

    + + public + static + + + + RundeckJobsUUIDImportBehavior + + valueOf + (String name) +

    +
    +
    + +
    + + + +
    +
    + +

    + +
    +
    + + + + +
    +

    + + public + static + final + + + RundeckJobsUUIDImportBehavior[] + + values + () +

    +
    +
    + +
    + + + +
    +
    + +

    + +
    +
    + + + + + + + + + + + + + + +
    + +
    + +
    + + + + + diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckNode.html b/apidocs/reference/org/rundeck/api/domain/RundeckNode.html index e469d54..950eca8 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckNode.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckNode.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckOutput.html b/apidocs/reference/org/rundeck/api/domain/RundeckOutput.html index f2f28d1..36c7384 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckOutput.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckOutput.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.RundeckLogLevel.html b/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.RundeckLogLevel.html index 0d5b09c..2bf04f2 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.RundeckLogLevel.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.RundeckLogLevel.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.html b/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.html index 1bf2602..ea912fd 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckOutputEntry.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckProject.html b/apidocs/reference/org/rundeck/api/domain/RundeckProject.html index 0b8fab6..1d3f9aa 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckProject.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckProject.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/RundeckSystemInfo.html b/apidocs/reference/org/rundeck/api/domain/RundeckSystemInfo.html index 7777fe4..7d28b1a 100644 --- a/apidocs/reference/org/rundeck/api/domain/RundeckSystemInfo.html +++ b/apidocs/reference/org/rundeck/api/domain/RundeckSystemInfo.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/package-descr.html b/apidocs/reference/org/rundeck/api/domain/package-descr.html index d57b912..35bc66b 100644 --- a/apidocs/reference/org/rundeck/api/domain/package-descr.html +++ b/apidocs/reference/org/rundeck/api/domain/package-descr.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • diff --git a/apidocs/reference/org/rundeck/api/domain/package-summary.html b/apidocs/reference/org/rundeck/api/domain/package-summary.html index 29ca2fa..bc513b2 100644 --- a/apidocs/reference/org/rundeck/api/domain/package-summary.html +++ b/apidocs/reference/org/rundeck/api/domain/package-summary.html @@ -185,6 +185,7 @@
  • RundeckEvent.EventStatus
  • RundeckExecution.ExecutionStatus
  • RundeckJobsImportMethod
  • +
  • RundeckJobsUUIDImportBehavior
  • RundeckOutputEntry.RundeckLogLevel
  • @@ -360,6 +361,10 @@ The behavior when importing jobs (which may already exist).  + RundeckJobsUUIDImportBehavior + $INTERFACE is ...  + + RundeckOutputEntry.RundeckLogLevel   diff --git a/changes-report.html b/changes-report.html index afcbb4b..7188a98 100644 --- a/changes-report.html +++ b/changes-report.html @@ -1,5 +1,5 @@ - + @@ -13,7 +13,7 @@ - + @@ -51,8 +51,8 @@
  • Changelog
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -126,10 +126,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -158,15 +158,15 @@
    -

    Changelog

    Release History

    VersionDateDescription
    8.02013-08-06Update for Rundeck API version 8
    6.02013-02-21Update for Rundeck API version 6
    5.02012-12-30Use RunDeck REST API version 5 (RunDeck 1.4.4)
    2.02011-08-01Use RunDeck REST API version 2 (RunDeck 1.3+)
    1.22011-07-31Ad-hoc scripts + history events
    1.12011-07-28Import / export jobs
    1.02011-07-08Use RunDeck REST API version 1 (RunDeck 1.2+)

    Release 8.0 - 2013-08-06

    TypeChangesBy

    add

    Support script interpreter parameters, API v8gschueler

    add

    Support project parameter for imported jobs, API v8gschueler

    update

    Replace unwieldy methods with many arguments with Builder based interfaces, deprecating the old methods. - The old methods will be removed completely in version 10 of this library. Fixes 2.gschueler

    Release 6.0 - 2013-02-21

    TypeChangesBy

    add

    Support update for output entry format, API v6 #1gschueler

    Release 5.0 - 2012-12-30

    TypeChangesBy

    add

    Job Execution result contains average duration (v5)gschueler

    fix

    Issue #1: execution results don't contain argstringgschueler

    add

    Bulk Job delete (v5)gschueler

    add

    Executions query (v5)gschueler

    add

    History query (v5)gschueler

    add

    Support Rundeck API version 5gschueler

    add

    Maintenance and support of rundeck-api-java-client now primarily provided by the Rundeck project, and is now available at https://rundeck.github.com/rundeck-api-java-clientgschueler

    add

    Add output download, profile page, API token generationconnaryscott

    add

    Support Cookie-based user session authenticationconnaryscott

    Release 2.0 - 2011-08-01

    TypeChangesBy

    add

    Token-based authenticationvbehar

    Release 1.2 - 2011-07-31

    TypeChangesBy

    add

    Run ad-hoc scriptsvbehar

    add

    List history eventsvbehar

    Release 1.1 - 2011-07-28

    TypeChangesBy

    add

    Import jobs (XML or YAML)vbehar

    add

    YAML format is now supported when exporting jobs definitionsvbehar

    add

    Support for using an HTTP proxyvbehar

    Release 1.0 - 2011-07-08

    TypeChangesBy

    add

    Initial releasevbehar
    +

    Changelog

    Release History

    VersionDateDescription
    9.12014-01-16Complete Rundeck API version 9
    9.02013-08-26Update for Rundeck API version 9
    8.02013-08-06Update for Rundeck API version 8
    6.02013-02-21Update for Rundeck API version 6
    5.02012-12-30Use RunDeck REST API version 5 (RunDeck 1.4.4)
    2.02011-08-01Use RunDeck REST API version 2 (RunDeck 1.3+)
    1.22011-07-31Ad-hoc scripts + history events
    1.12011-07-28Import / export jobs
    1.02011-07-08Use RunDeck REST API version 1 (RunDeck 1.2+)

    Release 9.1 - 2014-01-16

    TypeChangesBy

    add

    Add uuidOption support to jobs import, API v9gschueler

    Release 9.0 - 2013-08-26

    TypeChangesBy

    add

    Add project to parsed execution result, API v9gschueler

    add

    Add project=* all projects executions now running query, API v9gschueler

    Release 8.0 - 2013-08-06

    TypeChangesBy

    add

    Support script interpreter parameters, API v8gschueler

    add

    Support project parameter for imported jobs, API v8gschueler

    update

    Replace unwieldy methods with many arguments with Builder based interfaces, deprecating the old methods. + The old methods will be removed completely in version 10 of this library. Fixes 2.gschueler

    Release 6.0 - 2013-02-21

    TypeChangesBy

    add

    Support update for output entry format, API v6 #1gschueler

    Release 5.0 - 2012-12-30

    TypeChangesBy

    add

    Job Execution result contains average duration (v5)gschueler

    fix

    Issue #1: execution results don't contain argstringgschueler

    add

    Bulk Job delete (v5)gschueler

    add

    Executions query (v5)gschueler

    add

    History query (v5)gschueler

    add

    Support Rundeck API version 5gschueler

    add

    Maintenance and support of rundeck-api-java-client now primarily provided by the Rundeck project, and is now available at https://rundeck.github.com/rundeck-api-java-clientgschueler

    add

    Add output download, profile page, API token generationconnaryscott

    add

    Support Cookie-based user session authenticationconnaryscott

    Release 2.0 - 2011-08-01

    TypeChangesBy

    add

    Token-based authenticationvbehar

    Release 1.2 - 2011-07-31

    TypeChangesBy

    add

    Run ad-hoc scriptsvbehar

    add

    List history eventsvbehar

    Release 1.1 - 2011-07-28

    TypeChangesBy

    add

    Import jobs (XML or YAML)vbehar

    add

    YAML format is now supported when exporting jobs definitionsvbehar

    add

    Support for using an HTTP proxyvbehar

    Release 1.0 - 2011-07-08

    TypeChangesBy

    add

    Initial releasevbehar
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/cpd.html b/cpd.html index 4b92bff..47aa2e1 100644 --- a/cpd.html +++ b/cpd.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • CPD Results
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -125,10 +125,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -157,7 +157,7 @@
    -

    CPD Results

    The following document contains the results of PMD's CPD 4.2.5.

    Duplications

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FileLine
    org/rundeck/api/domain/RundeckEvent.java152
    org/rundeck/api/domain/RundeckExecution.java137
        }
    +          

    CPD Results

    The following document contains the results of PMD's CPD 4.2.5.

    Duplications

    FileLine
    org/rundeck/api/domain/RundeckEvent.java152
    org/rundeck/api/domain/RundeckExecution.java138
        }
     
         public Date getStartedAt() {
             return (startedAt != null) ? new Date(startedAt.getTime()) : null;
    @@ -183,7 +183,7 @@
             this.abortedBy = abortedBy;
         }
     
    -    public String getDescription() {
    FileLine
    org/rundeck/api/domain/RundeckEvent.java60
    org/rundeck/api/domain/RundeckExecution.java59
        public Long getDurationInMillis() {
    +    public String getDescription() {
    + + + + + + + + + + + + +
    FileLine
    org/rundeck/api/domain/RundeckEvent.java60
    org/rundeck/api/domain/RundeckExecution.java60
        public Long getDurationInMillis() {
             if (startedAt == null || endedAt == null) {
                 return null;
             }
    @@ -223,7 +223,7 @@
     
         
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/cpd.xml b/cpd.xml index cd6d7b5..a237f75 100644 --- a/cpd.xml +++ b/cpd.xml @@ -1,8 +1,8 @@ - - + + - - + + - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Project Dependencies
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,12 +100,6 @@
  • Project Information
      -
    • - Continuous Integration -
    • -
    • - Dependencies -
    • Distribution Management
    • @@ -113,7 +107,13 @@ About
    • + Dependencies +
    • +
    • Issue Tracking +
    • +
    • + Continuous Integration
    • Project License @@ -168,36 +168,36 @@ } } -

      Dependency Tree

      • org.rundeck:rundeck-api-java-client:jar:8.0 Information
        • org.apache.httpcomponents:httpclient:jar:4.1.2 (compile) Information
          • org.apache.httpcomponents:httpcore:jar:4.1.2 (compile) Information
          • commons-logging:commons-logging:jar:1.1.1 (compile) Information
          • commons-codec:commons-codec:jar:1.4 (compile) Information
        • com.ibm.icu:icu4j:jar:2.6.1 (compile) Information
    • junit:junit:jar:4.10 (test) Information
      • org.hamcrest:hamcrest-core:jar:1.1 (test) Information
    • com.github.robfletcher:betamax:jar:1.0 (test) Information
    • org.codehaus.groovy:groovy-all:jar:1.8.4 (test) Information
  • Licenses

    LGPL: xom

    BSD style: Hamcrest Core

    Eclipse Public License - Version 1.0: Jetty :: Continuation, Jetty :: Http Utility, Jetty :: IO Utility, Jetty :: Server Core, Jetty :: Utilities

    Unknown: Groovy, Unnamed - com.ibm.icu:icu4j:jar:2.6.1, Unnamed - javax.servlet:servlet-api:jar:2.5, Unnamed - jdom:jdom:jar:1.0, Unnamed - xalan:xalan:jar:2.6.0, Unnamed - xerces:xercesImpl:jar:2.6.2, Unnamed - xerces:xmlParserAPIs:jar:2.6.2, dom4j, jaxen

    Apache License: HttpClient, HttpCore, HttpMime

    Apache Software License - Version 2.0: Jetty :: Continuation, Jetty :: Http Utility, Jetty :: IO Utility, Jetty :: Server Core, Jetty :: Utilities

    Common Public License Version 1.0: JUnit

    The Apache Software License, Version 2.0: Apache Log4j, Betamax - An HTTP stubbing proxy for testing JVM applications., Commons Codec, Commons IO, Commons Lang, Commons Logging, RunDeck API - Java Client, XML Commons External Components XML APIs

    Apache License Version 2.0: SnakeYAML

    Dependency File Details

    FilenameSizeEntriesClassesPackagesJDK RevDebugSealed
    betamax-1.0.jar160.45 kB685971.5debug-
    icu4j-2.6.1.jar2.34 MB75564861.2debug-
    commons-codec-1.4.jar56.80 kB473051.4debug-
    commons-io-2.1.jar159.33 kB12210461.5debug-
    commons-lang-2.6.jar277.56 kB155133101.3debug-
    commons-logging-1.1.1.jar59.26 kB422821.1debug-
    dom4j-1.6.1.jar306.54 kB208190141.3debug-
    servlet-api-2.5.jar102.65 kB684221.5debug-
    jaxen-1.1.1.jar221.60 kB236214171.2debug-
    jdom-1.0.jar149.66 kB877581.1debug-
    junit-4.10.jar247.23 kB290252311.5debug-
    log4j-1.2.16.jar470.25 kB346308201.1debug-
    httpclient-4.1.2.jar344.00 kB309273221.5debug-
    httpcore-4.1.2.jar176.95 kB185163101.3debug-
    httpmime-4.1.2.jar26.26 kB311521.5debug-
    groovy-all-1.8.4.jar5.86 MB3,8723,686961.5debug-
    jetty-continuation-7.5.1.v20110908.jar19.72 kB231111.5debug-
    jetty-http-7.5.1.v20110908.jar110.53 kB674941.5debug-
    jetty-io-7.5.1.v20110908.jar90.57 kB695531.5debug-
    jetty-server-7.5.1.v20110908.jar296.87 kB17513991.5debug-
    jetty-util-7.5.1.v20110908.jar208.08 kB14012081.5debug-
    hamcrest-core-1.1.jar74.85 kB542131.5debug-
    snakeyaml-1.9.jar259.59 kB238202191.5debug-
    xalan-2.6.0.jar3.00 MB1,6251,548501.1debug-
    xercesImpl-2.6.2.jar986.99 kB845784371.1release-
    xmlParserAPIs-2.6.2.jar121.80 kB238207171.1release-
    xml-apis-1.0.b2.jar106.76 kB217184171.2release-
    xom-1.0.jar106.32 kB1089661.2releasesealed
    TotalSizeEntriesClassesPackagesJDK RevDebugSealed
    2816.22 MB10,6209,6364321.5241
    compile: 16compile: 8.37 MBcompile: 5,210compile: 4,692compile: 229-compile: 12compile: 1
    test: 12test: 7.85 MBtest: 5,410test: 4,944test: 203-test: 12-

    Dependency Repository Locations

    Repo IDURLReleaseSnapshot
    sonatype-snapshotshttp://oss.sonatype.org/content/groups/jettyYesYes-
    apache.snapshotshttp://people.apache.org/repo/m2-snapshot-repository-Yes-
    sonatype-nexus-snapshotshttps://oss.sonatype.org/content/repositories/snapshots-Yes-
    sonatype-public-gridhttp://repository.sonatype.org/content/groups/sonatype-public-grid/YesYes-
    centralhttp://repo1.maven.org/maven2Yes--

    Repository locations for each of the Dependencies.

    Artifactsonatype-snapshotsapache.snapshotssonatype-nexus-snapshotssonatype-public-gridcentral
    com.github.robfletcher:betamax:jar:1.0---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    com.ibm.icu:icu4j:jar:2.6.1---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    commons-codec:commons-codec:jar:1.4---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    commons-io:commons-io:jar:2.1---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    commons-lang:commons-lang:jar:2.6---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    commons-logging:commons-logging:jar:1.1.1---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    dom4j:dom4j:jar:1.6.1---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    javax.servlet:servlet-api:jar:2.5---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    jaxen:jaxen:jar:1.1.1---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    jdom:jdom:jar:1.0---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    junit:junit:jar:4.10---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    log4j:log4j:jar:1.2.16---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.apache.httpcomponents:httpclient:jar:4.1.2---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.apache.httpcomponents:httpcore:jar:4.1.2---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.apache.httpcomponents:httpmime:jar:4.1.2---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.codehaus.groovy:groovy-all:jar:1.8.4---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.eclipse.jetty:jetty-continuation:jar:7.5.1.v20110908Found at http://oss.sonatype.org/content/groups/jetty--Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.eclipse.jetty:jetty-http:jar:7.5.1.v20110908Found at http://oss.sonatype.org/content/groups/jetty--Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.eclipse.jetty:jetty-io:jar:7.5.1.v20110908Found at http://oss.sonatype.org/content/groups/jetty--Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.eclipse.jetty:jetty-server:jar:7.5.1.v20110908Found at http://oss.sonatype.org/content/groups/jetty--Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.eclipse.jetty:jetty-util:jar:7.5.1.v20110908Found at http://oss.sonatype.org/content/groups/jetty--Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.hamcrest:hamcrest-core:jar:1.1---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    org.yaml:snakeyaml:jar:1.9---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    xalan:xalan:jar:2.6.0---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    xerces:xercesImpl:jar:2.6.2---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    xerces:xmlParserAPIs:jar:2.6.2---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    xml-apis:xml-apis:jar:1.0.b2---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    xom:xom:jar:1.0---Found at http://repository.sonatype.org/content/groups/sonatype-public-grid/Found at http://repo1.maven.org/maven2
    Totalsonatype-snapshotsapache.snapshotssonatype-nexus-snapshotssonatype-public-gridcentral
    28 (compile: 16, test: 12)5002828
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/dependency-updates-report.html b/dependency-updates-report.html index c72484e..9fba0c8 100644 --- a/dependency-updates-report.html +++ b/dependency-updates-report.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Dependency Updates Report
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -125,10 +125,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -157,14 +157,14 @@
    -

    Overview

    This report summarizes newer versions that may be available for your project's various dependencies.

    # of dependencies using the latest version available2
    # of dependencies where the next version available is smaller than an incremental version update1
    # of dependencies where the next version available is an incremental version update5
    # of dependencies where the next version available is a minor version update1
    # of dependencies where the next version available is a major version update0

    Dependency Management

    This project does not declare any dependencies in a dependencyManagement section.

    Dependencies

    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major
    com.github.robfletcherbetamax1.0testjar
    commons-iocommons-io2.1compilejar2.2
    commons-langcommons-lang2.6compilejar
    dom4jdom4j1.6.1compilejar1.6.1-hudson-320040902.021138
    jaxenjaxen1.1.1compilejar1.1.3
    junitjunit4.10testjar4.11-beta-14.11
    org.apache.httpcomponentshttpclient4.1.2compilejar4.1.34.2
    org.apache.httpcomponentshttpmime4.1.2compilejar4.1.34.2
    org.codehaus.groovygroovy-all1.8.4testjar1.8.52.0.0-beta-12.0.0
    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major

    Dependency Updates

    com.github.robfletcher:betamax

    Status No newer versions available.
    Group Idcom.github.robfletcher
    Artifact Idbetamax
    Current Version1.0
    Scopetest
    Classifier
    Typejar

    commons-io:commons-io

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idcommons-io
    Artifact Idcommons-io
    Current Version2.1
    Scopecompile
    Classifier
    Typejar
    Newer versions2.2 Next Minor
    2.3
    2.4 Latest Minor

    commons-lang:commons-lang

    Status No newer versions available.
    Group Idcommons-lang
    Artifact Idcommons-lang
    Current Version2.6
    Scopecompile
    Classifier
    Typejar

    dom4j:dom4j

    Status There is at least one newer version available.
    Group Iddom4j
    Artifact Iddom4j
    Current Version1.6.1
    Scopecompile
    Classifier
    Typejar
    Newer versions1.6.1-hudson-3 Next Version
    1.6.1-patch
    20040902.021138 Next Major

    jaxen:jaxen

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idjaxen
    Artifact Idjaxen
    Current Version1.1.1
    Scopecompile
    Classifier
    Typejar
    Newer versions1.1.3 Next Incremental
    1.1.4 Latest Incremental

    junit:junit

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idjunit
    Artifact Idjunit
    Current Version4.10
    Scopetest
    Classifier
    Typejar
    Newer versions4.11-beta-1 Next Incremental
    4.11 Next Minor

    org.apache.httpcomponents:httpclient

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.httpcomponents
    Artifact Idhttpclient
    Current Version4.1.2
    Scopecompile
    Classifier
    Typejar
    Newer versions4.1.3 Next Incremental
    4.2-alpha1
    4.2-beta1 Latest Incremental
    4.2 Next Minor
    4.2.1
    4.2.1-atlassian-1
    4.2.1-atlassian-2
    4.2.2
    4.2.3
    4.2.4
    4.2.5
    4.3-alpha1
    4.3-beta1
    4.3-beta2 Latest Minor

    org.apache.httpcomponents:httpmime

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.httpcomponents
    Artifact Idhttpmime
    Current Version4.1.2
    Scopecompile
    Classifier
    Typejar
    Newer versions4.1.3 Next Incremental
    4.2-alpha1
    4.2-beta1 Latest Incremental
    4.2 Next Minor
    4.2.1
    4.2.1-atlassian-1
    4.2.1-atlassian-2
    4.2.2
    4.2.3
    4.2.4
    4.2.5
    4.3-alpha1
    4.3-beta1
    4.3-beta2 Latest Minor

    org.codehaus.groovy:groovy-all

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.codehaus.groovy
    Artifact Idgroovy-all
    Current Version1.8.4
    Scopetest
    Classifier
    Typejar
    Newer versions1.8.5 Next Incremental
    1.8.6
    1.8.7
    1.8.8
    1.8.9
    1.9.0-beta-1
    1.9.0-beta-2
    1.9.0-beta-3
    1.9.0-beta-4 Latest Incremental
    2.0.0-beta-1 Next Minor
    2.0.0-beta-2
    2.0.0-beta-3
    2.0.0-rc-1
    2.0.0-rc-2
    2.0.0-rc-3
    2.0.0-rc-4 Latest Minor
    2.0.0 Next Major
    2.0.1
    2.0.2
    2.0.3
    2.0.4
    2.0.5
    2.0.6
    2.0.7
    2.0.8
    2.1.0-beta-1
    2.1.0-rc-1
    2.1.0-rc-2
    2.1.0-rc-3
    2.1.0
    2.1.1
    2.1.2
    2.1.3
    2.1.4
    2.1.5
    2.1.6
    2.2.0-beta-1 Latest Major
    +

    Overview

    This report summarizes newer versions that may be available for your project's various dependencies.

    # of dependencies using the latest version available3
    # of dependencies where the next version available is smaller than an incremental version update0
    # of dependencies where the next version available is an incremental version update5
    # of dependencies where the next version available is a minor version update1
    # of dependencies where the next version available is a major version update0

    Dependency Management

    This project does not declare any dependencies in a dependencyManagement section.

    Dependencies

    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major
    com.github.robfletcherbetamax1.0testjar
    commons-iocommons-io2.1compilejar2.2
    commons-langcommons-lang2.6compilejar
    dom4jdom4j1.6.1compilejar
    jaxenjaxen1.1.1compilejar1.1.3
    junitjunit4.10testjar4.11-beta-14.11
    org.apache.httpcomponentshttpclient4.1.2compilejar4.1.34.2
    org.apache.httpcomponentshttpmime4.1.2compilejar4.1.34.2
    org.codehaus.groovygroovy-all1.8.4testjar1.8.52.0.0-beta-12.0.0
    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major

    Dependency Updates

    com.github.robfletcher:betamax

    Status No newer versions available.
    Group Idcom.github.robfletcher
    Artifact Idbetamax
    Current Version1.0
    Scopetest
    Classifier
    Typejar

    commons-io:commons-io

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idcommons-io
    Artifact Idcommons-io
    Current Version2.1
    Scopecompile
    Classifier
    Typejar
    Newer versions2.2 Next Minor
    2.3
    2.4 Latest Minor

    commons-lang:commons-lang

    Status No newer versions available.
    Group Idcommons-lang
    Artifact Idcommons-lang
    Current Version2.6
    Scopecompile
    Classifier
    Typejar

    dom4j:dom4j

    Status No newer versions available.
    Group Iddom4j
    Artifact Iddom4j
    Current Version1.6.1
    Scopecompile
    Classifier
    Typejar

    jaxen:jaxen

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idjaxen
    Artifact Idjaxen
    Current Version1.1.1
    Scopecompile
    Classifier
    Typejar
    Newer versions1.1.3 Next Incremental
    1.1.4
    1.1.6 Latest Incremental

    junit:junit

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idjunit
    Artifact Idjunit
    Current Version4.10
    Scopetest
    Classifier
    Typejar
    Newer versions4.11-beta-1 Next Incremental
    4.11 Next Minor

    org.apache.httpcomponents:httpclient

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.httpcomponents
    Artifact Idhttpclient
    Current Version4.1.2
    Scopecompile
    Classifier
    Typejar
    Newer versions4.1.3 Next Incremental
    4.2-alpha1
    4.2-beta1 Latest Incremental
    4.2 Next Minor
    4.2.1-atlassian-1
    4.2.1-atlassian-2
    4.2.1
    4.2.2
    4.2.3
    4.2.4
    4.2.5
    4.2.6
    4.3-alpha1
    4.3-beta1
    4.3-beta2
    4.3
    4.3.1
    4.3.2 Latest Minor

    org.apache.httpcomponents:httpmime

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.httpcomponents
    Artifact Idhttpmime
    Current Version4.1.2
    Scopecompile
    Classifier
    Typejar
    Newer versions4.1.3 Next Incremental
    4.2-alpha1
    4.2-beta1 Latest Incremental
    4.2 Next Minor
    4.2.1-atlassian-1
    4.2.1-atlassian-2
    4.2.1
    4.2.2
    4.2.3
    4.2.4
    4.2.5
    4.2.6
    4.3-alpha1
    4.3-beta1
    4.3-beta2
    4.3
    4.3.1
    4.3.2 Latest Minor

    org.codehaus.groovy:groovy-all

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.codehaus.groovy
    Artifact Idgroovy-all
    Current Version1.8.4
    Scopetest
    Classifier
    Typejar
    Newer versions1.8.5 Next Incremental
    1.8.6
    1.8.7
    1.8.8
    1.8.9
    1.9.0-beta-1
    1.9.0-beta-2
    1.9.0-beta-3
    1.9.0-beta-4 Latest Incremental
    2.0.0-beta-1 Next Minor
    2.0.0-beta-2
    2.0.0-beta-3
    2.0.0-rc-1
    2.0.0-rc-2
    2.0.0-rc-3
    2.0.0-rc-4 Latest Minor
    2.0.0 Next Major
    2.0.1
    2.0.2
    2.0.3
    2.0.4
    2.0.5
    2.0.6
    2.0.7
    2.0.8
    2.1.0-beta-1
    2.1.0-rc-1
    2.1.0-rc-2
    2.1.0-rc-3
    2.1.0
    2.1.1
    2.1.2
    2.1.3
    2.1.4
    2.1.5
    2.1.6
    2.1.7
    2.1.8
    2.1.9
    2.2.0-beta-1
    2.2.0-beta-2
    2.2.0-rc-1
    2.2.0-rc-2
    2.2.0-rc-3
    2.2.0
    2.2.1 Latest Major
  • -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/distribution-management.html b/distribution-management.html index 72e4a75..05cf87f 100644 --- a/distribution-management.html +++ b/distribution-management.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Project Distribution Management
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -101,19 +101,19 @@ Project Information
    • - Continuous Integration -
    • -
    • - Dependencies -
    • -
    • Distribution Management
    • About +
    • +
    • + Dependencies
    • Issue Tracking +
    • +
    • + Continuous Integration
    • Project License @@ -158,7 +158,7 @@
      -
      Copyright © 2011-2013. +
      Copyright © 2011-2014. All Rights Reserved.
      diff --git a/download.html b/download.html index b34b987..a2e347d 100644 --- a/download.html +++ b/download.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
    • -
    • Last Published: 2013-08-06
    • |
    • -
    • Version: 8.0
    • +
    • Last Published: 2014-01-16
    • |
    • +
    • Version: 9.2-SNAPSHOT
    @@ -126,7 +126,7 @@
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/faq.html b/faq.html index 46ae798..9b52067 100644 --- a/faq.html +++ b/faq.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Frequently Asked Questions
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -161,7 +161,7 @@
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/findbugs.html b/findbugs.html index 72abc86..5442bb0 100644 --- a/findbugs.html +++ b/findbugs.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • FindBugs Bug Detector Report
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -125,10 +125,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -157,14 +157,14 @@
    -

    FindBugs Bug Detector Report

    The following document contains the results of FindBugs Report

    FindBugs Version is 1.3.9

    Threshold is medium

    Effort is min

    Summary

    ClassesBugsErrorsMissing Classes
    76200

    org.rundeck.api.query.ExecutionQuery

    BugCategoryDetailsLinePriority
    org.rundeck.api.query.ExecutionQuery.getBegin() may expose internal representation by returning ExecutionQuery.beginMALICIOUS_CODEEI_EXPOSE_REP139Medium
    org.rundeck.api.query.ExecutionQuery.getEnd() may expose internal representation by returning ExecutionQuery.endMALICIOUS_CODEEI_EXPOSE_REP143Medium
    +

    FindBugs Bug Detector Report

    The following document contains the results of FindBugs Report

    FindBugs Version is 1.3.9

    Threshold is medium

    Effort is min

    Summary

    ClassesBugsErrorsMissing Classes
    77200

    org.rundeck.api.query.ExecutionQuery

    BugCategoryDetailsLinePriority
    org.rundeck.api.query.ExecutionQuery.getBegin() may expose internal representation by returning ExecutionQuery.beginMALICIOUS_CODEEI_EXPOSE_REP139Medium
    org.rundeck.api.query.ExecutionQuery.getEnd() may expose internal representation by returning ExecutionQuery.endMALICIOUS_CODEEI_EXPOSE_REP143Medium
  • -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/groovy.html b/groovy.html index 2d9b53c..e70108b 100644 --- a/groovy.html +++ b/groovy.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -197,7 +197,7 @@ println "${result.succeededJobs.size} jobs successfully imported, ${result.
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/index.html b/index.html index afb63a4..8cf5dc2 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
  • @@ -101,21 +101,21 @@ Project Information
    • - Continuous Integration -
    • -
    • - Dependencies -
    • -
    • Distribution Management
    • About +
    • +
    • + Dependencies
    • Issue Tracking
    • + Continuous Integration +
    • +
    • Project License
    • @@ -158,7 +158,7 @@
      -
      Copyright © 2011-2013. +
      Copyright © 2011-2014. All Rights Reserved.
      diff --git a/issue-tracking.html b/issue-tracking.html index 23cda90..68ba2e2 100644 --- a/issue-tracking.html +++ b/issue-tracking.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
    • Issue Tracking
    • -
    • Last Published: 2013-08-06
    • |
    • -
    • Version: 8.0
    • +
    • Last Published: 2014-01-16
    • |
    • +
    • Version: 9.2-SNAPSHOT
    @@ -100,21 +100,21 @@
  • Project Information
  • @@ -205,7 +205,7 @@ puts "#{result.succeededJobs.size} jobs successfully imported, #{result.ski
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/jython.html b/jython.html index 633d527..f90df71 100644 --- a/jython.html +++ b/jython.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -194,7 +194,7 @@ print("%s jobs successfully imported, %s jobs skipped, and %s jobs failed&q
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/license.html b/license.html index 94dfb75..617366e 100644 --- a/license.html +++ b/license.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Project License
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
      -
    • - Continuous Integration -
    • -
    • - Dependencies -
    • Distribution Management
    • About +
    • +
    • + Dependencies
    • Issue Tracking +
    • +
    • + Continuous Integration
    • Project License @@ -359,7 +359,7 @@
      -
      Copyright © 2011-2013. +
      Copyright © 2011-2014. All Rights Reserved.
      diff --git a/mail-lists.html b/mail-lists.html index 5eaef3e..9720ba1 100644 --- a/mail-lists.html +++ b/mail-lists.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
    • Project Mailing Lists
    • -
    • Last Published: 2013-08-06
    • |
    • -
    • Version: 8.0
    • +
    • Last Published: 2014-01-16
    • |
    • +
    • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
  • @@ -125,12 +125,12 @@ Dependency Updates Report
  • - Plugin Updates Report -
  • -
  • Property Updates Report
  • + Plugin Updates Report +
  • +
  • PMD Report
  • @@ -157,14 +157,14 @@
    -

    Overview

    This report summarizes newer versions that may be available for your project's various plugins.

    # of plugins using the latest version available3
    # of plugins where the next version available is smaller than an incremental version update0
    # of plugins where the next version available is an incremental version update3
    # of plugins where the next version available is a minor version update15
    # of plugins where the next version available is a major version update0
    # of plugins where a dependencies section containes a dependency with an updated version0

    Plugin Management

    StatusGroup IdArtifact IdCurrent VersionNext VersionNext IncrementalNext MinorNext MajorDependency status
    org.apache.maven.pluginsmaven-antrun-plugin1.7
    org.apache.maven.pluginsmaven-assembly-plugin2.2.22.3
    org.apache.maven.pluginsmaven-checkstyle-plugin2.82.9
    org.apache.maven.pluginsmaven-clean-plugin2.4.12.5
    org.apache.maven.pluginsmaven-compiler-plugin2.3.22.43.0
    org.apache.maven.pluginsmaven-dependency-plugin2.32.4
    org.apache.maven.pluginsmaven-deploy-plugin2.7
    org.apache.maven.pluginsmaven-eclipse-plugin2.82.9
    org.apache.maven.pluginsmaven-enforcer-plugin1.0.11.1
    org.apache.maven.pluginsmaven-gpg-plugin1.4
    org.apache.maven.pluginsmaven-help-plugin2.1.12.2
    org.apache.maven.pluginsmaven-install-plugin2.3.12.4
    org.apache.maven.pluginsmaven-jar-plugin2.3.22.4
    org.apache.maven.pluginsmaven-javadoc-plugin2.82.8.12.9
    org.apache.maven.pluginsmaven-pmd-plugin2.62.73.0
    org.apache.maven.pluginsmaven-release-plugin2.2.12.2.22.3
    org.apache.maven.pluginsmaven-resources-plugin2.52.6
    org.apache.maven.pluginsmaven-site-plugin3.03.1
    org.apache.maven.pluginsmaven-source-plugin2.1.22.2
    org.apache.maven.pluginsmaven-surefire-plugin2.102.11
    org.codehaus.mojofindbugs-maven-plugin2.3.22.3.32.4.0
    StatusGroup IdArtifact IdCurrent VersionNext VersionNext IncrementalNext MinorNext MajorDependency status

    Plugins

    This project does not declare any plugins in a build/plugins setcion.

    Plugin Updates

    Plugin org.apache.maven.plugins:maven-antrun-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-antrun-plugin
    Current Version1.7

    Plugin org.apache.maven.plugins:maven-assembly-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-assembly-plugin
    Current Version2.2.2
    Newer versions2.3 Next Minor
    2.4 Latest Minor

    Plugin org.apache.maven.plugins:maven-checkstyle-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-checkstyle-plugin
    Current Version2.8
    Newer versions2.9 Next Minor
    2.9.1
    2.10 Latest Minor

    Plugin org.apache.maven.plugins:maven-clean-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-clean-plugin
    Current Version2.4.1
    Newer versions2.5 Next Minor

    Plugin org.apache.maven.plugins:maven-compiler-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-compiler-plugin
    Current Version2.3.2
    Newer versions2.4 Next Minor
    2.5
    2.5.1 Latest Minor
    3.0 Next Major
    3.1 Latest Major

    Plugin org.apache.maven.plugins:maven-dependency-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-dependency-plugin
    Current Version2.3
    Newer versions2.4 Next Minor
    2.5
    2.5.1
    2.6
    2.7
    2.8 Latest Minor

    Plugin org.apache.maven.plugins:maven-deploy-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-deploy-plugin
    Current Version2.7

    Plugin org.apache.maven.plugins:maven-eclipse-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-eclipse-plugin
    Current Version2.8
    Newer versions2.9 Next Minor

    Plugin org.apache.maven.plugins:maven-enforcer-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-enforcer-plugin
    Current Version1.0.1
    Newer versions1.1 Next Minor
    1.1.1
    1.2
    1.3 Latest Minor

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-gpg-plugin
    Current Version1.4

    Plugin org.apache.maven.plugins:maven-help-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-help-plugin
    Current Version2.1.1
    Newer versions2.2 Next Minor

    Plugin org.apache.maven.plugins:maven-install-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-install-plugin
    Current Version2.3.1
    Newer versions2.4 Next Minor

    Plugin org.apache.maven.plugins:maven-jar-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-jar-plugin
    Current Version2.3.2
    Newer versions2.4 Next Minor

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.8
    Newer versions2.8.1 Next Incremental
    2.9 Next Minor
    2.9.1 Latest Minor

    Plugin org.apache.maven.plugins:maven-pmd-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-pmd-plugin
    Current Version2.6
    Newer versions2.7 Next Minor
    2.7.1 Latest Minor
    3.0 Next Major
    3.0.1 Latest Major

    Plugin org.apache.maven.plugins:maven-release-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-release-plugin
    Current Version2.2.1
    Newer versions2.2.2 Next Incremental
    2.3 Next Minor
    2.3.1
    2.3.2
    2.4
    2.4.1 Latest Minor

    Plugin org.apache.maven.plugins:maven-resources-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-resources-plugin
    Current Version2.5
    Newer versions2.6 Next Minor

    Plugin org.apache.maven.plugins:maven-site-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-site-plugin
    Current Version3.0
    Newer versions3.1 Next Minor
    3.2
    3.3 Latest Minor

    Plugin org.apache.maven.plugins:maven-source-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.1.2
    Newer versions2.2 Next Minor
    2.2.1 Latest Minor

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-surefire-plugin
    Current Version2.10
    Newer versions2.11 Next Minor
    2.12
    2.12.1
    2.12.2
    2.12.3
    2.12.4
    2.13
    2.14
    2.14.1
    2.15 Latest Minor

    Plugin org.codehaus.mojo:findbugs-maven-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.codehaus.mojo
    Artifact Idfindbugs-maven-plugin
    Current Version2.3.2
    Newer versions2.3.3 Next Incremental
    2.4.0 Next Minor
    2.5
    2.5.1
    2.5.2 Latest Minor
    +

    Overview

    This report summarizes newer versions that may be available for your project's various plugins.

    # of plugins using the latest version available5
    # of plugins where the next version available is smaller than an incremental version update1
    # of plugins where the next version available is an incremental version update4
    # of plugins where the next version available is a minor version update21
    # of plugins where the next version available is a major version update0
    # of plugins where a dependencies section containes a dependency with an updated version0

    Plugin Management

    StatusGroup IdArtifact IdCurrent VersionNext VersionNext IncrementalNext MinorNext MajorDependency status
    org.apache.maven.pluginsmaven-antrun-plugin1.7
    org.apache.maven.pluginsmaven-assembly-plugin2.2.22.3
    org.apache.maven.pluginsmaven-checkstyle-plugin2.82.9
    org.apache.maven.pluginsmaven-clean-plugin2.4.12.5
    org.apache.maven.pluginsmaven-compiler-plugin2.3.22.43.0
    org.apache.maven.pluginsmaven-dependency-plugin2.32.4
    org.apache.maven.pluginsmaven-deploy-plugin2.7
    org.apache.maven.pluginsmaven-ear-plugin2.3.12.3.22.4
    org.apache.maven.pluginsmaven-eclipse-plugin2.82.9
    org.apache.maven.pluginsmaven-ejb-plugin2.12.2
    org.apache.maven.pluginsmaven-enforcer-plugin1.0.11.1
    org.apache.maven.pluginsmaven-gpg-plugin1.4
    org.apache.maven.pluginsmaven-help-plugin2.1.12.2
    org.apache.maven.pluginsmaven-install-plugin2.3.12.4
    org.apache.maven.pluginsmaven-jar-plugin2.3.22.4
    org.apache.maven.pluginsmaven-javadoc-plugin2.82.8.12.9
    org.apache.maven.pluginsmaven-plugin-plugin2.4.32.53.0
    org.apache.maven.pluginsmaven-pmd-plugin2.62.73.0
    org.apache.maven.pluginsmaven-rar-plugin2.22.3
    org.apache.maven.pluginsmaven-release-plugin2.2.12.2.22.3
    org.apache.maven.pluginsmaven-resources-plugin2.52.6
    org.apache.maven.pluginsmaven-site-plugin3.03.1
    org.apache.maven.pluginsmaven-source-plugin2.1.22.2
    org.apache.maven.pluginsmaven-surefire-plugin2.102.11
    org.apache.maven.pluginsmaven-war-plugin2.1-alpha-22.1-beta-12.1.12.2
    org.codehaus.mojofindbugs-maven-plugin2.3.22.3.32.4.0
    StatusGroup IdArtifact IdCurrent VersionNext VersionNext IncrementalNext MinorNext MajorDependency status

    Plugins

    StatusGroup IdArtifact IdCurrent VersionNext VersionNext IncrementalNext MinorNext MajorDependency status
    org.apache.maven.pluginsmaven-changes-plugin2.62.7
    org.apache.maven.pluginsmaven-jxr-plugin2.3
    org.apache.maven.pluginsmaven-project-info-reports-plugin2.42.5
    org.codehaus.mojotaglist-maven-plugin2.4
    org.codehaus.mojoversions-maven-plugin1.21.32.0
    StatusGroup IdArtifact IdCurrent VersionNext VersionNext IncrementalNext MinorNext MajorDependency status

    Plugin Updates

    Plugin org.apache.maven.plugins:maven-antrun-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-antrun-plugin
    Current Version1.7

    Plugin org.apache.maven.plugins:maven-assembly-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-assembly-plugin
    Current Version2.2.2
    Newer versions2.3 Next Minor
    2.4 Latest Minor

    Plugin org.apache.maven.plugins:maven-changes-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-changes-plugin
    Current Version2.6
    Newer versions2.7 Next Minor
    2.7.1
    2.8
    2.9 Latest Minor

    Plugin org.apache.maven.plugins:maven-checkstyle-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-checkstyle-plugin
    Current Version2.8
    Newer versions2.9 Next Minor
    2.9.1
    2.10 Latest Minor

    Plugin org.apache.maven.plugins:maven-clean-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-clean-plugin
    Current Version2.4.1
    Newer versions2.5 Next Minor

    Plugin org.apache.maven.plugins:maven-compiler-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-compiler-plugin
    Current Version2.3.2
    Newer versions2.4 Next Minor
    2.5
    2.5.1 Latest Minor
    3.0 Next Major
    3.1 Latest Major

    Plugin org.apache.maven.plugins:maven-dependency-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-dependency-plugin
    Current Version2.3
    Newer versions2.4 Next Minor
    2.5
    2.5.1
    2.6
    2.7
    2.8 Latest Minor

    Plugin org.apache.maven.plugins:maven-deploy-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-deploy-plugin
    Current Version2.7

    Plugin org.apache.maven.plugins:maven-ear-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-ear-plugin
    Current Version2.3.1
    Newer versions2.3.2 Next Incremental
    2.4 Next Minor
    2.4.1
    2.4.2
    2.5
    2.6
    2.7
    2.8
    2.9 Latest Minor

    Plugin org.apache.maven.plugins:maven-eclipse-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-eclipse-plugin
    Current Version2.8
    Newer versions2.9 Next Minor

    Plugin org.apache.maven.plugins:maven-ejb-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-ejb-plugin
    Current Version2.1
    Newer versions2.2 Next Minor
    2.2.1
    2.3 Latest Minor

    Plugin org.apache.maven.plugins:maven-enforcer-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-enforcer-plugin
    Current Version1.0.1
    Newer versions1.1 Next Minor
    1.1.1
    1.2
    1.3 Latest Minor

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-gpg-plugin
    Current Version1.4

    Plugin org.apache.maven.plugins:maven-help-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-help-plugin
    Current Version2.1.1
    Newer versions2.2 Next Minor

    Plugin org.apache.maven.plugins:maven-install-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-install-plugin
    Current Version2.3.1
    Newer versions2.4 Next Minor

    Plugin org.apache.maven.plugins:maven-jar-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-jar-plugin
    Current Version2.3.2
    Newer versions2.4 Next Minor

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.8
    Newer versions2.8.1 Next Incremental
    2.9 Next Minor
    2.9.1 Latest Minor

    Plugin org.apache.maven.plugins:maven-jxr-plugin

    Status No newer versions available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-jxr-plugin
    Current Version2.3

    Plugin org.apache.maven.plugins:maven-plugin-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-plugin-plugin
    Current Version2.4.3
    Newer versions2.5 Next Minor
    2.5.1
    2.6
    2.7
    2.8
    2.9 Latest Minor
    3.0 Next Major
    3.1
    3.2 Latest Major

    Plugin org.apache.maven.plugins:maven-pmd-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-pmd-plugin
    Current Version2.6
    Newer versions2.7 Next Minor
    2.7.1 Latest Minor
    3.0 Next Major
    3.0.1 Latest Major

    Plugin org.apache.maven.plugins:maven-project-info-reports-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-project-info-reports-plugin
    Current Version2.4
    Newer versions2.5 Next Minor
    2.5.1
    2.6
    2.7 Latest Minor

    Plugin org.apache.maven.plugins:maven-rar-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-rar-plugin
    Current Version2.2
    Newer versions2.3 Next Minor

    Plugin org.apache.maven.plugins:maven-release-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-release-plugin
    Current Version2.2.1
    Newer versions2.2.2 Next Incremental
    2.3 Next Minor
    2.3.1
    2.3.2
    2.4
    2.4.1 Latest Minor

    Plugin org.apache.maven.plugins:maven-resources-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-resources-plugin
    Current Version2.5
    Newer versions2.6 Next Minor

    Plugin org.apache.maven.plugins:maven-site-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-site-plugin
    Current Version3.0
    Newer versions3.1 Next Minor
    3.2
    3.3 Latest Minor

    Plugin org.apache.maven.plugins:maven-source-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.1.2
    Newer versions2.2 Next Minor
    2.2.1 Latest Minor

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-surefire-plugin
    Current Version2.10
    Newer versions2.11 Next Minor
    2.12
    2.12.1
    2.12.2
    2.12.3
    2.12.4
    2.13
    2.14
    2.14.1
    2.15 Latest Minor

    Plugin org.apache.maven.plugins:maven-war-plugin

    Status There is at least one newer version available.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-war-plugin
    Current Version2.1-alpha-2
    Newer versions2.1-beta-1 Next Version
    2.1
    2.1.1 Next Incremental
    2.2 Next Minor
    2.3
    2.4 Latest Minor

    Plugin org.codehaus.mojo:findbugs-maven-plugin

    Status There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Idorg.codehaus.mojo
    Artifact Idfindbugs-maven-plugin
    Current Version2.3.2
    Newer versions2.3.3 Next Incremental
    2.4.0 Next Minor
    2.5
    2.5.1
    2.5.2 Latest Minor

    Plugin org.codehaus.mojo:taglist-maven-plugin

    Status No newer versions available.
    Group Idorg.codehaus.mojo
    Artifact Idtaglist-maven-plugin
    Current Version2.4

    Plugin org.codehaus.mojo:versions-maven-plugin

    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.codehaus.mojo
    Artifact Idversions-maven-plugin
    Current Version1.2
    Newer versions1.3 Next Minor
    1.3.1 Latest Minor
    2.0 Next Major
    2.1 Latest Major
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/pmd.html b/pmd.html index c954248..00937ef 100644 --- a/pmd.html +++ b/pmd.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • PMD Results
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -125,10 +125,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -164,7 +164,7 @@
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/pmd.xml b/pmd.xml index 7a10884..57e1fa8 100644 --- a/pmd.xml +++ b/pmd.xml @@ -1,11 +1,11 @@ - - + + Avoid unused imports such as 'org.rundeck.api.domain.RundeckExecution.ExecutionStatus' - + Avoid unused imports such as 'org.dom4j.Element' @@ -13,12 +13,12 @@ Avoid unused imports such as 'org.dom4j.Element' Avoid empty catch blocks - + Avoid unused imports such as 'org.dom4j.Element' - + Avoid empty catch blocks diff --git a/project-info.html b/project-info.html index a7a6416..365000d 100644 --- a/project-info.html +++ b/project-info.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Project Information
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
      -
    • - Continuous Integration -
    • -
    • - Dependencies -
    • Distribution Management
    • About +
    • +
    • + Dependencies
    • Issue Tracking +
    • +
    • + Continuous Integration
    • Project License @@ -151,14 +151,14 @@
      -

      Project Information

      This document provides an overview of the various documents and links that are part of this project's general information. All of this content is automatically generated by Maven on behalf of the project.

      Overview

      DocumentDescription
      Continuous IntegrationThis is a link to the definitions of all continuous integration processes that builds and tests code on a frequent, regular basis.
      DependenciesThis document lists the project's dependencies and provides information on each dependency.
      Distribution ManagementThis document provides informations on the distribution management of this project.
      AboutJava client for the RunDeck REST API
      Issue TrackingThis is a link to the issue management system for this project. Issues (bugs, features, change requests) can be created and queried using this link.
      Project LicenseThis is a link to the definitions of project licenses.
      Mailing ListsThis document provides subscription and archive information for this project's mailing lists.
      Project TeamThis document provides information on the members of this project. These are the individuals who have contributed to the project in one form or another.
      Source RepositoryThis is a link to the online source repository that can be viewed via a web browser.
      Project SummaryThis document lists other related information of this project
      +

      Project Information

      This document provides an overview of the various documents and links that are part of this project's general information. All of this content is automatically generated by Maven on behalf of the project.

      Overview

      DocumentDescription
      Distribution ManagementThis document provides informations on the distribution management of this project.
      AboutJava client for the RunDeck REST API
      DependenciesThis document lists the project's dependencies and provides information on each dependency.
      Issue TrackingThis is a link to the issue management system for this project. Issues (bugs, features, change requests) can be created and queried using this link.
      Continuous IntegrationThis is a link to the definitions of all continuous integration processes that builds and tests code on a frequent, regular basis.
      Project LicenseThis is a link to the definitions of project licenses.
      Mailing ListsThis document provides subscription and archive information for this project's mailing lists.
      Project TeamThis document provides information on the members of this project. These are the individuals who have contributed to the project in one form or another.
      Source RepositoryThis is a link to the online source repository that can be viewed via a web browser.
      Project SummaryThis document lists other related information of this project
  • -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/project-reports.html b/project-reports.html index 0a2f7ff..014d5ea 100644 --- a/project-reports.html +++ b/project-reports.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Generated Reports
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -125,10 +125,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -157,14 +157,14 @@
    -

    Generated Reports

    This document provides an overview of the various reports that are automatically generated by Maven . Each report is briefly described below.

    Overview

    DocumentDescription
    JavaDocsJavaDoc API documentation.
    Test JavaDocsTest JavaDoc API documentation.
    Source XrefHTML based, cross-reference version of Java source code.
    Test Source XrefHTML based, cross-reference version of Java test source code.
    Tag ListReport on various tags found in the code.
    Changes ReportChanges Report on Releases of the Project.
    Dependency Updates ReportProvides details of the dependencies which have updated versions available.
    Plugin Updates ReportProvides details of the plugins used by this project which have newer versions available.
    Property Updates ReportProvides details of properties which control versions of dependencies and/or plugins, and indicates any newer versions which are available.
    PMD ReportVerification of coding rules.
    CPD ReportDuplicate code detection.
    FindBugs ReportGenerates a source code report with the FindBugs Library.
    +

    Generated Reports

    This document provides an overview of the various reports that are automatically generated by Maven . Each report is briefly described below.

    Overview

    DocumentDescription
    JavaDocsJavaDoc API documentation.
    Test JavaDocsTest JavaDoc API documentation.
    Source XrefHTML based, cross-reference version of Java source code.
    Test Source XrefHTML based, cross-reference version of Java test source code.
    Tag ListReport on various tags found in the code.
    Changes ReportChanges Report on Releases of the Project.
    Dependency Updates ReportProvides details of the dependencies which have updated versions available.
    Property Updates ReportProvides details of properties which control versions of dependencies and/or plugins, and indicates any newer versions which are available.
    Plugin Updates ReportProvides details of the plugins used by this project which have newer versions available.
    PMD ReportVerification of coding rules.
    CPD ReportDuplicate code detection.
    FindBugs ReportGenerates a source code report with the FindBugs Library.
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/project-summary.html b/project-summary.html index f1b0771..e42e048 100644 --- a/project-summary.html +++ b/project-summary.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Project Summary
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
  • -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/property-updates-report.html b/property-updates-report.html index 108f4eb..a1d5b93 100644 --- a/property-updates-report.html +++ b/property-updates-report.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Property Updates Report
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -123,13 +123,13 @@
  • Dependency Updates Report -
  • -
  • - Plugin Updates Report
  • Property Updates Report
  • +
  • + Plugin Updates Report +
  • PMD Report
  • @@ -164,7 +164,7 @@
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/scripting.html b/scripting.html index a0b05e3..d33746d 100644 --- a/scripting.html +++ b/scripting.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -126,7 +126,7 @@
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/source-repository.html b/source-repository.html index 08b1d77..eed7dfa 100644 --- a/source-repository.html +++ b/source-repository.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Source Repository
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
  • @@ -119,14 +119,14 @@
    -

    Status of the implementation of the RunDeck API

    RunDeck API version 1

    Documentation of the RunDeck API version 1

    • Login-based authentication - OK
    • System Info - OK
    • Listing Jobs - OK
    • Running a Job - OK
    • Exporting Jobs - OK
    • Importing Jobs - OK
    • Getting a Job Definition - OK
    • Deleting a Job Definition - OK
    • Getting Executions for a Job - OK
    • Listing Running Executions - OK
    • Getting Execution Info - OK
    • Aborting Executions - OK
    • Running Adhoc Commands - OK
    • Running Adhoc Scripts - OK
    • Listing Projects - OK
    • Getting Project Info - OK
    • Listing History - OK
    • Creating History Event Reports - TODO
    • Listing Resources - OK
    • Getting Resource Info - OK

    RunDeck API version 2

    Documentation of the RunDeck API version 2

    • Token-based authentication - OK
    • Listing Jobs for a Project - TODO
    • Updating and Listing Resources for a Project - TODO
    • Refreshing Resources for a Project - TODO

    RunDeck API version 3

    Documentation of the RunDeck API version 3

    • (only updates to Resource endpoints) - TODO

    RunDeck API version 4

    Documentation of the RunDeck API version 4

    • Running Adhoc Script URLs - TODO

    RunDeck API version 5

    Documentation of the RunDeck API version 5

    • Bulk Job Delete - OK
    • Execution Output - OK
    • Execution Query - OK
    • History list query - OK

    RunDeck API version 6

    Documentation of the RunDeck API version 6

    • Execution Output format fixed - OK

    RunDeck API version 7

    Documentation of the RunDeck API version 7

    • Incubator for cluster mode job takeover - TODO

    RunDeck API version 8

    Documentation of the RunDeck API version 8

    • scriptInterpreter addition to run script and run url - OK
    • project parameter added to jobs import - OK
    +

    Status of the implementation of the RunDeck API

    RunDeck API version 1

    Documentation of the RunDeck API version 1

    • Login-based authentication - OK
    • System Info - OK
    • Listing Jobs - OK
    • Running a Job - OK
    • Exporting Jobs - OK
    • Importing Jobs - OK
    • Getting a Job Definition - OK
    • Deleting a Job Definition - OK
    • Getting Executions for a Job - OK
    • Listing Running Executions - OK
    • Getting Execution Info - OK
    • Aborting Executions - OK
    • Running Adhoc Commands - OK
    • Running Adhoc Scripts - OK
    • Listing Projects - OK
    • Getting Project Info - OK
    • Listing History - OK
    • Creating History Event Reports - TODO
    • Listing Resources - OK
    • Getting Resource Info - OK

    RunDeck API version 2

    Documentation of the RunDeck API version 2

    • Token-based authentication - OK
    • Listing Jobs for a Project - TODO
    • Updating and Listing Resources for a Project - TODO
    • Refreshing Resources for a Project - TODO

    RunDeck API version 3

    Documentation of the RunDeck API version 3

    • (only updates to Resource endpoints) - TODO

    RunDeck API version 4

    Documentation of the RunDeck API version 4

    • Running Adhoc Script URLs - TODO

    RunDeck API version 5

    Documentation of the RunDeck API version 5

    • Bulk Job Delete - OK
    • Execution Output - OK
    • Execution Query - OK
    • History list query - OK

    RunDeck API version 6

    Documentation of the RunDeck API version 6

    • Execution Output format fixed - OK

    RunDeck API version 7

    Documentation of the RunDeck API version 7

    • Incubator for cluster mode job takeover - TODO

    RunDeck API version 8

    Documentation of the RunDeck API version 8

    • scriptInterpreter addition to run script and run url - OK
    • project parameter added to jobs import - OK

    RunDeck API version 9

    Documentation of the RunDeck API version 9

    • list running executions across all projects - OK
    • include project name in execution results - OK
    • Add uuidOption parameter to allow removing imported UUIDs to avoid creation conflicts - OK
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/taglist.html b/taglist.html index c8ec602..3e6e30e 100644 --- a/taglist.html +++ b/taglist.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Tag List report
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -125,10 +125,10 @@ Dependency Updates Report
  • - Plugin Updates Report + Property Updates Report
  • - Property Updates Report + Plugin Updates Report
  • PMD Report @@ -164,7 +164,7 @@
    -
    Copyright © 2011-2013. +
    Copyright © 2011-2014. All Rights Reserved.
    diff --git a/team-list.html b/team-list.html index eb5f0b8..3ddc500 100644 --- a/team-list.html +++ b/team-list.html @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -50,8 +50,8 @@
  • Team list
  • -
  • Last Published: 2013-08-06
  • |
  • -
  • Version: 8.0
  • +
  • Last Published: 2014-01-16
  • |
  • +
  • Version: 9.2-SNAPSHOT
  • @@ -100,20 +100,20 @@
  • Project Information
      -
    • - Continuous Integration -
    • -
    • - Dependencies -
    • Distribution Management
    • About +
    • +
    • + Dependencies
    • Issue Tracking +
    • +
    • + Continuous Integration
    • Project License @@ -173,7 +173,7 @@ window.onLoad = init();
      -
      Copyright © 2011-2013. +
      Copyright © 2011-2014. All Rights Reserved.
      diff --git a/testapidocs/proof-read.txt b/testapidocs/proof-read.txt index 7de4051..9efac14 100644 --- a/testapidocs/proof-read.txt +++ b/testapidocs/proof-read.txt @@ -94,6 +94,7 @@ METHOD: parseAdhocExecution METHOD: parseMinimalistExecution METHOD: parseRunningExecution METHOD: parseSucceededExecution +METHOD: parseV9Execution === org/rundeck/api/parser/EventParserTest.html === @@ -142,6 +143,8 @@ FIELD: TEST_TOKEN_1 FIELD: TEST_TOKEN_2 FIELD: TEST_TOKEN_3 FIELD: TEST_TOKEN_4 +FIELD: TEST_TOKEN_5 +FIELD: TEST_TOKEN_6 FIELD: recorder CONSTRUCTOR: RundeckClientTest METHOD: abortExecution @@ -168,6 +171,15 @@ METHOD: importJobsProjectParamOverride Import jobs, project parameter overrides xml METHOD: importJobsProjectParamV7 Import jobs, project parameter v7 doesn' use parameter +METHOD: importJobsUUIDParamPreserveV9 + Import jobs, project parameter v7 doesn' use parameter +METHOD: importJobsUUIDParamRemoveV9 + Import jobs, project parameter v7 doesn' use parameter +METHOD: runningExecutionsV8 + Running executions for all projects using API v8, which queries for project list and then individually + queries each project's now running +METHOD: runningExecutionsV9 + Running executions for all projects using API v9 METHOD: setUp METHOD: triggerAdhocCommand METHOD: triggerAdhocCommandAsUser diff --git a/testapidocs/reference/current.xml b/testapidocs/reference/current.xml index 4a4cd06..f321415 100644 --- a/testapidocs/reference/current.xml +++ b/testapidocs/reference/current.xml @@ -251,6 +251,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
  • StringTEST_TOKEN_5
    StringTEST_TOKEN_6
    @@ -771,6 +785,79 @@ Summary: + void +
    + importJobsUUIDParamPreserveV9() + +
    Import jobs, project parameter v7 doesn' use parameter
    + +
    + + + + + + void + + importJobsUUIDParamRemoveV9() + +
    Import jobs, project parameter v7 doesn' use parameter
    + +
    + + + + + + void + + runningExecutionsV8() + +
    Running executions for all projects using API v8, which queries for project list and then individually + queries each project's now running
    + +
    + + + + + + void + + runningExecutionsV9() + +
    Running executions for all projects using API v9
    + +
    + + + + + void @@ -1532,6 +1619,84 @@ From class + + +
    +

    + + public + static + final + String + + TEST_TOKEN_5 +

    +
    + + + + + + +
    +
    + +

    + + +
    + Constant Value: + + + "C3O6d5O98Kr6Dpv71sdE4ERdCuU12P6d" + + +
    + +
    +
    + + + + + +
    +

    + + public + static + final + String + + TEST_TOKEN_6 +

    +
    + + + + + + +
    +
    + +

    + + +
    + Constant Value: + + + "Do4d3NUD5DKk21DR4sNK755RcPk618vn" + + +
    + +
    +
    + + + @@ -2348,6 +2513,167 @@ From class + + +
    +

    + + public + + + + + void + + importJobsUUIDParamPreserveV9 + () +

    +
    +
    + +
    + + + +
    +
    + +

    Import jobs, project parameter v7 doesn' use parameter

    +
    +
    Throws
    + + + + +
    Exception +
    +
    + +
    +
    + + + + +
    +

    + + public + + + + + void + + importJobsUUIDParamRemoveV9 + () +

    +
    +
    + +
    + + + +
    +
    + +

    Import jobs, project parameter v7 doesn' use parameter

    +
    +
    Throws
    + + + + +
    Exception +
    +
    + +
    +
    + + + + +
    +

    + + public + + + + + void + + runningExecutionsV8 + () +

    +
    +
    + +
    + + + +
    +
    + +

    Running executions for all projects using API v8, which queries for project list and then individually + queries each project's now running

    +
    +
    Throws
    + + + + +
    Exception +
    +
    + +
    +
    + + + + +
    +

    + + public + + + + + void + + runningExecutionsV9 + () +

    +
    +
    + +
    + + + +
    +
    + +

    Running executions for all projects using API v9

    +
    +
    Throws
    + + + + +
    Exception +
    +
    + +
    +
    + +
    diff --git a/testapidocs/reference/org/rundeck/api/parser/ExecutionParserTest.html b/testapidocs/reference/org/rundeck/api/parser/ExecutionParserTest.html index b695d81..1434e0e 100644 --- a/testapidocs/reference/org/rundeck/api/parser/ExecutionParserTest.html +++ b/testapidocs/reference/org/rundeck/api/parser/ExecutionParserTest.html @@ -465,6 +465,22 @@ Summary:
    + + + + + + void + + parseV9Execution() + +
    @@ -921,6 +937,46 @@ From class
    + + +
    +

    + + public + + + + + void + + parseV9Execution + () +

    +
    +
    + +
    + + + +
    +
    + +

    +
    +
    Throws
    + + + + +
    Exception +
    +
    + +
    +
    + + diff --git a/xref-test/index.html b/xref-test/index.html index b1874b6..5169ac7 100644 --- a/xref-test/index.html +++ b/xref-test/index.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference + RunDeck API - Java Client 9.2-SNAPSHOT Reference diff --git a/xref-test/org/rundeck/api/RundeckClientTest.html b/xref-test/org/rundeck/api/RundeckClientTest.html index a41316c..913ec7a 100644 --- a/xref-test/org/rundeck/api/RundeckClientTest.html +++ b/xref-test/org/rundeck/api/RundeckClientTest.html @@ -63,887 +63,998 @@ 53 public static final String TEST_TOKEN_2 = "PP4s4SdCRO6KUoNPd1D303Dc304ORN87"; 54 public static final String TEST_TOKEN_3 = "9RdEosesKP3se4oV9EKOd4s3RUeUS3ON"; 55 public static final String TEST_TOKEN_4 = "sN5RRSNvu15DnV6EcNDdc2CkdPcv3s32"; -56 -57 @Rule -58 public Recorder recorder = new Recorder(); -59 -60 private RundeckClient client; +56 public static final String TEST_TOKEN_5 = "C3O6d5O98Kr6Dpv71sdE4ERdCuU12P6d"; +57 public static final String TEST_TOKEN_6 = "Do4d3NUD5DKk21DR4sNK755RcPk618vn"; +58 +59 @Rule +60 public Recorder recorder = new Recorder(); 61 -62 @Test -63 @Betamax(tape = "get_projects") -64 public void getProjects() throws Exception { -65 List<RundeckProject> projects = client.getProjects(); -66 Assert.assertEquals(1, projects.size()); -67 Assert.assertEquals("test", projects.get(0).getName()); -68 Assert.assertNull(projects.get(0).getDescription()); -69 } -70 @Test -71 @Betamax(tape = "get_history") -72 public void getHistory() throws Exception { -73 final RundeckHistory test = client.getHistory("test"); -74 Assert.assertEquals(3, test.getCount()); -75 Assert.assertEquals(20, test.getMax()); -76 Assert.assertEquals(0, test.getOffset()); -77 Assert.assertEquals(5, test.getTotal()); -78 final List<RundeckEvent> events = test.getEvents(); -79 Assert.assertEquals(3, events.size()); -80 } -81 -82 @Test -83 @Betamax(tape = "get_history_joblist", -84 match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query /*, MatchRule.body */}) -85 public void getHistoryJoblist() throws Exception { -86 final List<String> jobNames = Arrays.asList("malk/blah", "malk/blah2"); -87 final RundeckHistory test = client.getHistory("demo", null, null, jobNames, null, null, null, null, null); -88 Assert.assertEquals(2, test.getCount()); -89 Assert.assertEquals(20, test.getMax()); -90 Assert.assertEquals(0, test.getOffset()); -91 Assert.assertEquals(2, test.getTotal()); -92 final List<RundeckEvent> events = test.getEvents(); -93 Assert.assertEquals(2, events.size()); -94 final List<String> names = new ArrayList<String>(); -95 for (final RundeckEvent event : events) { -96 names.add(event.getTitle()); -97 } -98 Assert.assertEquals(Arrays.asList("malk/blah2", "malk/blah"), names); -99 } -100 -101 @Test -102 @Betamax(tape = "get_history_excludeJoblist", -103 match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query /*, MatchRule.body */}) -104 public void getHistoryExcludeJoblist() throws Exception { -105 final List<String> jobNames = Arrays.asList("malk/blah", "malk/blah2"); -106 final RundeckHistory test = client.getHistory("demo", null, null, null, jobNames, null, null, null, null); -107 Assert.assertEquals(2, test.getCount()); -108 Assert.assertEquals(20, test.getMax()); -109 Assert.assertEquals(0, test.getOffset()); -110 Assert.assertEquals(2, test.getTotal()); -111 final List<RundeckEvent> events = test.getEvents(); -112 Assert.assertEquals(2, events.size()); -113 final List<String> names = new ArrayList<String>(); -114 for (final RundeckEvent event : events) { -115 names.add(event.getTitle()); -116 } -117 Assert.assertEquals(Arrays.asList("fliff", "malk/blah3"), names); -118 } -119 -120 @Test -121 @Betamax(tape = "get_history_user", -122 match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query }) -123 public void getHistoryUser() throws Exception { -124 final RundeckHistory test = client.getHistory("demo", "bob", (String)null, (List)null, null, null, null, 1L, 0L); -125 Assert.assertEquals(1, test.getCount()); -126 Assert.assertEquals(20, test.getMax()); -127 Assert.assertEquals(0, test.getOffset()); -128 Assert.assertEquals(1, test.getTotal()); -129 final List<RundeckEvent> events = test.getEvents(); -130 Assert.assertEquals(1, events.size()); -131 final List<String> names = new ArrayList<String>(); -132 for (final RundeckEvent event : events) { -133 names.add(event.getUser()); -134 } -135 Assert.assertEquals(Arrays.asList("bob"), names); -136 } -137 -138 @Test -139 @Betamax(tape = "get_executions", -140 mode = TapeMode.READ_ONLY, -141 match = {MatchRule.uri, MatchRule.headers, MatchRule.method, MatchRule.path, MatchRule.query}) -142 public void getExecutions() throws Exception { -143 -144 RundeckClient client = createClient(TEST_TOKEN_1, 5); +62 private RundeckClient client; +63 +64 @Test +65 @Betamax(tape = "get_projects") +66 public void getProjects() throws Exception { +67 List<RundeckProject> projects = client.getProjects(); +68 Assert.assertEquals(1, projects.size()); +69 Assert.assertEquals("test", projects.get(0).getName()); +70 Assert.assertNull(projects.get(0).getDescription()); +71 } +72 @Test +73 @Betamax(tape = "get_history") +74 public void getHistory() throws Exception { +75 final RundeckHistory test = client.getHistory("test"); +76 Assert.assertEquals(3, test.getCount()); +77 Assert.assertEquals(20, test.getMax()); +78 Assert.assertEquals(0, test.getOffset()); +79 Assert.assertEquals(5, test.getTotal()); +80 final List<RundeckEvent> events = test.getEvents(); +81 Assert.assertEquals(3, events.size()); +82 } +83 +84 @Test +85 @Betamax(tape = "get_history_joblist", +86 match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query /*, MatchRule.body */}) +87 public void getHistoryJoblist() throws Exception { +88 final List<String> jobNames = Arrays.asList("malk/blah", "malk/blah2"); +89 final RundeckHistory test = client.getHistory("demo", null, null, jobNames, null, null, null, null, null); +90 Assert.assertEquals(2, test.getCount()); +91 Assert.assertEquals(20, test.getMax()); +92 Assert.assertEquals(0, test.getOffset()); +93 Assert.assertEquals(2, test.getTotal()); +94 final List<RundeckEvent> events = test.getEvents(); +95 Assert.assertEquals(2, events.size()); +96 final List<String> names = new ArrayList<String>(); +97 for (final RundeckEvent event : events) { +98 names.add(event.getTitle()); +99 } +100 Assert.assertEquals(Arrays.asList("malk/blah2", "malk/blah"), names); +101 } +102 +103 @Test +104 @Betamax(tape = "get_history_excludeJoblist", +105 match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query /*, MatchRule.body */}) +106 public void getHistoryExcludeJoblist() throws Exception { +107 final List<String> jobNames = Arrays.asList("malk/blah", "malk/blah2"); +108 final RundeckHistory test = client.getHistory("demo", null, null, null, jobNames, null, null, null, null); +109 Assert.assertEquals(2, test.getCount()); +110 Assert.assertEquals(20, test.getMax()); +111 Assert.assertEquals(0, test.getOffset()); +112 Assert.assertEquals(2, test.getTotal()); +113 final List<RundeckEvent> events = test.getEvents(); +114 Assert.assertEquals(2, events.size()); +115 final List<String> names = new ArrayList<String>(); +116 for (final RundeckEvent event : events) { +117 names.add(event.getTitle()); +118 } +119 Assert.assertEquals(Arrays.asList("fliff", "malk/blah3"), names); +120 } +121 +122 @Test +123 @Betamax(tape = "get_history_user", +124 match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query }) +125 public void getHistoryUser() throws Exception { +126 final RundeckHistory test = client.getHistory("demo", "bob", (String)null, (List)null, null, null, null, 1L, 0L); +127 Assert.assertEquals(1, test.getCount()); +128 Assert.assertEquals(20, test.getMax()); +129 Assert.assertEquals(0, test.getOffset()); +130 Assert.assertEquals(1, test.getTotal()); +131 final List<RundeckEvent> events = test.getEvents(); +132 Assert.assertEquals(1, events.size()); +133 final List<String> names = new ArrayList<String>(); +134 for (final RundeckEvent event : events) { +135 names.add(event.getUser()); +136 } +137 Assert.assertEquals(Arrays.asList("bob"), names); +138 } +139 +140 @Test +141 @Betamax(tape = "get_executions", +142 mode = TapeMode.READ_ONLY, +143 match = {MatchRule.uri, MatchRule.headers, MatchRule.method, MatchRule.path, MatchRule.query}) +144 public void getExecutions() throws Exception { 145 -146 -147 final String projectName = "blah"; -148 final PagedResults<RundeckExecution> jobTest = client.getExecutions(ExecutionQuery.builder() -149 .project(projectName) -150 .job("test job") -151 .build(), -152 2L, -153 0L); -154 assertPageResults(jobTest, 2, 2, 2, 0, 2); -155 final PagedResults<RundeckExecution> jobExactTest = client.getExecutions(ExecutionQuery.builder() -156 .project(projectName) -157 .jobExact("test job") -158 .build(), -159 2L, -160 0L); -161 assertPageResults(jobExactTest, 2, 2, 2, 0, 2); -162 final PagedResults<RundeckExecution> excludeJobTest = client.getExecutions(ExecutionQuery.builder() -163 .project(projectName) -164 .excludeJob("test job") -165 .build(), -166 2L, -167 0L); -168 assertPageResults(excludeJobTest, 2, 2, 2, 0, 2); -169 final PagedResults<RundeckExecution> excludeJobExactTest = client.getExecutions(ExecutionQuery.builder() -170 .project(projectName) -171 .excludeJobExact("test job") -172 .build(), -173 2L, -174 0L); -175 assertPageResults(excludeJobExactTest, 2, 2, 2, 0, 2); -176 final PagedResults<RundeckExecution> descriptionTest = client.getExecutions(ExecutionQuery.builder() -177 .project(projectName) -178 .description("a description") -179 .build(), 2L, 0L); -180 assertPageResults(descriptionTest, 2, 2, 2, 0, 2); -181 final PagedResults<RundeckExecution> abortedbyTest = client.getExecutions(ExecutionQuery.builder() -182 .project(projectName) -183 .abortedby("admin") -184 .build(), -185 2L, -186 0L); -187 assertPageResults(abortedbyTest, 1, 1, 2, 0, 1); -188 final PagedResults<RundeckExecution> beginTest = client.getExecutions(ExecutionQuery.builder() -189 .project(projectName) -190 .begin(new Date(1347581178168L)) -191 .build(), 2L, 0L); -192 assertPageResults(beginTest, 2, 2, 2, 0, 2); -193 final PagedResults<RundeckExecution> endTest = client.getExecutions(ExecutionQuery.builder() -194 .project(projectName) -195 .end(new Date(1347581178168L)) -196 .build(), 2L, 0L); -197 assertPageResults(endTest, 2, 2, 2, 0, 2); -198 final List<String> excludeJobIdList = Arrays.asList("123", "456"); -199 final PagedResults<RundeckExecution> excludeJobIdListTest = client.getExecutions(ExecutionQuery.builder() -200 .project(projectName) -201 .excludeJobIdList(excludeJobIdList) -202 .build(), 2L, 0L); -203 assertPageResults(excludeJobIdListTest, 2, 2, 2, 0, 2); -204 final List<String> jobList = Arrays.asList("fruit/mango", "fruit/lemon"); -205 final PagedResults<RundeckExecution> jobListTest = client.getExecutions(ExecutionQuery.builder() -206 .project(projectName) -207 .jobList(jobList) -208 .build(), 2L, 0L); -209 assertPageResults(jobListTest, 2, 2, 2, 0, 2); -210 final List<String> excludeJobList = Arrays.asList("a/path/job1", "path/to/job2"); -211 final PagedResults<RundeckExecution> excludeJobListTest = client.getExecutions(ExecutionQuery.builder() -212 .project(projectName) -213 .excludeJobList(excludeJobList) -214 .build(), 2L, 0L); -215 assertPageResults(excludeJobListTest, 2, 2, 2, 0, 2); -216 final List<String> list = Arrays.asList("1f4415d7-3b52-4fc8-ba42-b6ac97508bff", -217 "d9fc5ee6-f1db-4d24-8808-feda18345bab"); -218 final PagedResults<RundeckExecution> jobIdListTest = client.getExecutions(ExecutionQuery.builder() -219 .project(projectName) -220 .jobIdList(list) -221 .build(), 2L, 0L); -222 assertPageResults(jobIdListTest, 2, 2, 2, 0, 2); -223 final PagedResults<RundeckExecution> groupPathTest = client.getExecutions(ExecutionQuery.builder() -224 .project(projectName) -225 .groupPath("fruit") -226 .build(), -227 2L, -228 0L); -229 assertPageResults(groupPathTest, 2, 2, 2, 0, 2); -230 final PagedResults<RundeckExecution> groupPathExactTest = client.getExecutions(ExecutionQuery.builder() -231 .project(projectName) -232 .groupPathExact("fruit") -233 .build(), 2L, 0L); -234 assertPageResults(groupPathExactTest, 2, 2, 2, 0, 2); -235 -236 final PagedResults<RundeckExecution> excludeGroupPathTest = client.getExecutions(ExecutionQuery.builder() -237 .project(projectName) -238 .excludeGroupPath("fruit") -239 .build(), -240 2L, -241 0L); -242 assertPageResults(excludeGroupPathTest, 2, 2, 2, 0, 2); -243 final PagedResults<RundeckExecution> excliudeGroupPathExactTest = client.getExecutions(ExecutionQuery.builder() -244 .project(projectName) -245 .excludeGroupPathExact("fruit") -246 .build(), 2L, 0L); -247 assertPageResults(excliudeGroupPathExactTest, 2, 2, 2, 0, 2); -248 -249 final PagedResults<RundeckExecution> recentTest = client.getExecutions(ExecutionQuery.builder() -250 .project(projectName) -251 .recent("1h").build(), 2L, 0L); -252 assertPageResults(recentTest, 2, 2, 2, 0, 2); -253 final PagedResults<RundeckExecution> statusTest = client.getExecutions(ExecutionQuery.builder() -254 .project(projectName) -255 .status(RundeckExecution.ExecutionStatus.SUCCEEDED) -256 .build(), 2L, 0L); -257 assertPageResults(statusTest, 2, 2, 2, 0, 2); -258 final PagedResults<RundeckExecution> adhocTest = client.getExecutions(ExecutionQuery.builder() -259 .project(projectName) -260 .adhoc(true) -261 .build(), 2L, 0L); -262 assertPageResults(adhocTest, 2, 2, 2, 0, 2); -263 } -264 -265 /** -266 * Test paging values from results -267 */ -268 @Test -269 @Betamax(tape = "get_executions_paging") -270 public void getExecutionsPaging() throws Exception{ -271 RundeckClient client = createClient(TEST_TOKEN_1, 5); -272 final String projectName = "blah"; -273 //2 max, 1 offset -274 final PagedResults<RundeckExecution> adhocTest = client.getExecutions(ExecutionQuery.builder() -275 .project(projectName) -276 .excludeGroupPathExact("fruit") -277 .build(), 2L, 1L); -278 //expect 2 count, 3 total -279 assertPageResults(adhocTest, 2, 2, 2, 1, 3); -280 -281 //FAKE results, testing paging attributes parsing +146 RundeckClient client = createClient(TEST_TOKEN_1, 5); +147 +148 +149 final String projectName = "blah"; +150 final PagedResults<RundeckExecution> jobTest = client.getExecutions(ExecutionQuery.builder() +151 .project(projectName) +152 .job("test job") +153 .build(), +154 2L, +155 0L); +156 assertPageResults(jobTest, 2, 2, 2, 0, 2); +157 final PagedResults<RundeckExecution> jobExactTest = client.getExecutions(ExecutionQuery.builder() +158 .project(projectName) +159 .jobExact("test job") +160 .build(), +161 2L, +162 0L); +163 assertPageResults(jobExactTest, 2, 2, 2, 0, 2); +164 final PagedResults<RundeckExecution> excludeJobTest = client.getExecutions(ExecutionQuery.builder() +165 .project(projectName) +166 .excludeJob("test job") +167 .build(), +168 2L, +169 0L); +170 assertPageResults(excludeJobTest, 2, 2, 2, 0, 2); +171 final PagedResults<RundeckExecution> excludeJobExactTest = client.getExecutions(ExecutionQuery.builder() +172 .project(projectName) +173 .excludeJobExact("test job") +174 .build(), +175 2L, +176 0L); +177 assertPageResults(excludeJobExactTest, 2, 2, 2, 0, 2); +178 final PagedResults<RundeckExecution> descriptionTest = client.getExecutions(ExecutionQuery.builder() +179 .project(projectName) +180 .description("a description") +181 .build(), 2L, 0L); +182 assertPageResults(descriptionTest, 2, 2, 2, 0, 2); +183 final PagedResults<RundeckExecution> abortedbyTest = client.getExecutions(ExecutionQuery.builder() +184 .project(projectName) +185 .abortedby("admin") +186 .build(), +187 2L, +188 0L); +189 assertPageResults(abortedbyTest, 1, 1, 2, 0, 1); +190 final PagedResults<RundeckExecution> beginTest = client.getExecutions(ExecutionQuery.builder() +191 .project(projectName) +192 .begin(new Date(1347581178168L)) +193 .build(), 2L, 0L); +194 assertPageResults(beginTest, 2, 2, 2, 0, 2); +195 final PagedResults<RundeckExecution> endTest = client.getExecutions(ExecutionQuery.builder() +196 .project(projectName) +197 .end(new Date(1347581178168L)) +198 .build(), 2L, 0L); +199 assertPageResults(endTest, 2, 2, 2, 0, 2); +200 final List<String> excludeJobIdList = Arrays.asList("123", "456"); +201 final PagedResults<RundeckExecution> excludeJobIdListTest = client.getExecutions(ExecutionQuery.builder() +202 .project(projectName) +203 .excludeJobIdList(excludeJobIdList) +204 .build(), 2L, 0L); +205 assertPageResults(excludeJobIdListTest, 2, 2, 2, 0, 2); +206 final List<String> jobList = Arrays.asList("fruit/mango", "fruit/lemon"); +207 final PagedResults<RundeckExecution> jobListTest = client.getExecutions(ExecutionQuery.builder() +208 .project(projectName) +209 .jobList(jobList) +210 .build(), 2L, 0L); +211 assertPageResults(jobListTest, 2, 2, 2, 0, 2); +212 final List<String> excludeJobList = Arrays.asList("a/path/job1", "path/to/job2"); +213 final PagedResults<RundeckExecution> excludeJobListTest = client.getExecutions(ExecutionQuery.builder() +214 .project(projectName) +215 .excludeJobList(excludeJobList) +216 .build(), 2L, 0L); +217 assertPageResults(excludeJobListTest, 2, 2, 2, 0, 2); +218 final List<String> list = Arrays.asList("1f4415d7-3b52-4fc8-ba42-b6ac97508bff", +219 "d9fc5ee6-f1db-4d24-8808-feda18345bab"); +220 final PagedResults<RundeckExecution> jobIdListTest = client.getExecutions(ExecutionQuery.builder() +221 .project(projectName) +222 .jobIdList(list) +223 .build(), 2L, 0L); +224 assertPageResults(jobIdListTest, 2, 2, 2, 0, 2); +225 final PagedResults<RundeckExecution> groupPathTest = client.getExecutions(ExecutionQuery.builder() +226 .project(projectName) +227 .groupPath("fruit") +228 .build(), +229 2L, +230 0L); +231 assertPageResults(groupPathTest, 2, 2, 2, 0, 2); +232 final PagedResults<RundeckExecution> groupPathExactTest = client.getExecutions(ExecutionQuery.builder() +233 .project(projectName) +234 .groupPathExact("fruit") +235 .build(), 2L, 0L); +236 assertPageResults(groupPathExactTest, 2, 2, 2, 0, 2); +237 +238 final PagedResults<RundeckExecution> excludeGroupPathTest = client.getExecutions(ExecutionQuery.builder() +239 .project(projectName) +240 .excludeGroupPath("fruit") +241 .build(), +242 2L, +243 0L); +244 assertPageResults(excludeGroupPathTest, 2, 2, 2, 0, 2); +245 final PagedResults<RundeckExecution> excliudeGroupPathExactTest = client.getExecutions(ExecutionQuery.builder() +246 .project(projectName) +247 .excludeGroupPathExact("fruit") +248 .build(), 2L, 0L); +249 assertPageResults(excliudeGroupPathExactTest, 2, 2, 2, 0, 2); +250 +251 final PagedResults<RundeckExecution> recentTest = client.getExecutions(ExecutionQuery.builder() +252 .project(projectName) +253 .recent("1h").build(), 2L, 0L); +254 assertPageResults(recentTest, 2, 2, 2, 0, 2); +255 final PagedResults<RundeckExecution> statusTest = client.getExecutions(ExecutionQuery.builder() +256 .project(projectName) +257 .status(RundeckExecution.ExecutionStatus.SUCCEEDED) +258 .build(), 2L, 0L); +259 assertPageResults(statusTest, 2, 2, 2, 0, 2); +260 final PagedResults<RundeckExecution> adhocTest = client.getExecutions(ExecutionQuery.builder() +261 .project(projectName) +262 .adhoc(true) +263 .build(), 2L, 0L); +264 assertPageResults(adhocTest, 2, 2, 2, 0, 2); +265 } +266 +267 /** +268 * Test paging values from results +269 */ +270 @Test +271 @Betamax(tape = "get_executions_paging") +272 public void getExecutionsPaging() throws Exception{ +273 RundeckClient client = createClient(TEST_TOKEN_1, 5); +274 final String projectName = "blah"; +275 //2 max, 1 offset +276 final PagedResults<RundeckExecution> adhocTest = client.getExecutions(ExecutionQuery.builder() +277 .project(projectName) +278 .excludeGroupPathExact("fruit") +279 .build(), 2L, 1L); +280 //expect 2 count, 3 total +281 assertPageResults(adhocTest, 2, 2, 2, 1, 3); 282 -283 //1 max, 1 offset -284 final PagedResults<RundeckExecution> test2 = client.getExecutions(ExecutionQuery.builder() -285 .project(projectName) -286 .excludeGroupPathExact("fruit") -287 .build(), 1L, 1L); -288 //expect no paging attributes -289 assertPageResults(test2, 2, -1, -1, -1, -1); -290 -291 //1 max, 2 offset -292 final PagedResults<RundeckExecution> test3 = client.getExecutions(ExecutionQuery.builder() -293 .project(projectName) -294 .excludeGroupPathExact("fruit") -295 .build(), 1L, 2L); -296 //invalid value for count -297 assertPageResults(test3, 2, -1, -1, -1, -1); -298 } -299 @Test -300 @Betamax(tape = "bulk_delete") -301 public void bulkDelete() throws Exception { -302 RundeckClient client = createClient(TEST_TOKEN_2, 5); -303 -304 final RundeckJobDeleteBulk deleteTest -305 = client.deleteJobs(Arrays.asList("0ce457b5-ba84-41ca-812e-02b31da355a4")); -306 Assert.assertTrue(deleteTest.isAllsuccessful()); -307 Assert.assertEquals(1, deleteTest.getRequestCount()); -308 Assert.assertEquals(1, deleteTest.getResults().size()); -309 -310 final RundeckJobDelete delete = deleteTest.getResults().get(0); -311 Assert.assertTrue(delete.isSuccessful()); -312 Assert.assertNull(delete.getError()); -313 Assert.assertNull(delete.getErrorCode()); -314 Assert.assertNotNull(delete.getMessage()); -315 Assert.assertEquals("0ce457b5-ba84-41ca-812e-02b31da355a4", delete.getId()); -316 } -317 @Test -318 @Betamax(tape = "bulk_delete_dne") -319 public void bulkDeleteFailDNE() throws Exception { -320 RundeckClient client = createClient(TEST_TOKEN_2, 5); -321 -322 final RundeckJobDeleteBulk deleteTest -323 = client.deleteJobs(Arrays.asList("does-not-exist")); -324 Assert.assertFalse(deleteTest.isAllsuccessful()); -325 Assert.assertEquals(1, deleteTest.getRequestCount()); -326 Assert.assertEquals(1, deleteTest.getResults().size()); -327 -328 final RundeckJobDelete delete = deleteTest.getResults().get(0); -329 Assert.assertFalse(delete.isSuccessful()); -330 Assert.assertNotNull(delete.getError()); -331 Assert.assertEquals("notfound", delete.getErrorCode()); -332 Assert.assertNull(delete.getMessage()); -333 Assert.assertEquals("does-not-exist", delete.getId()); -334 } -335 @Test -336 @Betamax(tape = "bulk_delete_unauthorized") -337 public void bulkDeleteFailUnauthorized() throws Exception { -338 RundeckClient client = createClient(TEST_TOKEN_2, 5); -339 -340 final RundeckJobDeleteBulk deleteTest -341 = client.deleteJobs(Arrays.asList("3a6d16be-4268-4d26-86a9-cebc1781f768")); -342 Assert.assertFalse(deleteTest.isAllsuccessful()); -343 Assert.assertEquals(1, deleteTest.getRequestCount()); -344 Assert.assertEquals(1, deleteTest.getResults().size()); -345 -346 final RundeckJobDelete delete = deleteTest.getResults().get(0); -347 Assert.assertFalse(delete.isSuccessful()); -348 Assert.assertNotNull(delete.getError()); -349 Assert.assertEquals("unauthorized", delete.getErrorCode()); -350 Assert.assertNull(delete.getMessage()); -351 Assert.assertEquals("3a6d16be-4268-4d26-86a9-cebc1781f768", delete.getId()); -352 } -353 @Test -354 @Betamax(tape = "trigger_job_basic") -355 public void triggerJobDeprecatedBasic() throws Exception { -356 RundeckClient client = createClient(TEST_TOKEN_3, 5); -357 -358 final RundeckExecution test -359 = client.triggerJob("3170ba0e-6093-4b58-94d2-52988aefbfc9", null, null, null); -360 -361 Assert.assertEquals((Long) 19L, test.getId()); -362 Assert.assertEquals(null, test.getArgstring()); -363 Assert.assertEquals(null, test.getAbortedBy()); -364 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); -365 Assert.assertEquals("admin", test.getStartedBy()); -366 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -367 -368 } -369 @Test -370 @Betamax(tape = "trigger_job_basic") -371 public void triggerJobBasic() throws Exception { -372 RundeckClient client = createClient(TEST_TOKEN_3, 5); -373 -374 final RundeckExecution test -375 = client.triggerJob(RunJobBuilder.builder().setJobId("3170ba0e-6093-4b58-94d2-52988aefbfc9").build()); -376 -377 Assert.assertEquals((Long) 19L, test.getId()); -378 Assert.assertEquals(null, test.getArgstring()); -379 Assert.assertEquals(null, test.getAbortedBy()); -380 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); -381 Assert.assertEquals("admin", test.getStartedBy()); -382 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -383 -384 } -385 @Test -386 @Betamax(tape = "trigger_job_as_user") -387 public void triggerJobDeprecatedAsUser() throws Exception { -388 RundeckClient client = createClient(TEST_TOKEN_3, 5); -389 -390 final RundeckExecution test -391 = client.triggerJob("3170ba0e-6093-4b58-94d2-52988aefbfc9", null, null, "api-java-client-user-test1"); -392 -393 Assert.assertEquals((Long) 20L, test.getId()); -394 Assert.assertEquals(null, test.getArgstring()); -395 Assert.assertEquals(null, test.getAbortedBy()); -396 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); -397 Assert.assertEquals("api-java-client-user-test1", test.getStartedBy()); -398 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -399 -400 } -401 @Test -402 @Betamax(tape = "trigger_job_as_user") -403 public void triggerJobAsUser() throws Exception { -404 RundeckClient client = createClient(TEST_TOKEN_3, 5); -405 -406 final RundeckExecution test -407 = client.triggerJob(RunJobBuilder.builder() -408 .setJobId("3170ba0e-6093-4b58-94d2-52988aefbfc9") -409 .setAsUser("api-java-client-user-test1") -410 .build()); -411 -412 Assert.assertEquals((Long)20L, test.getId()); -413 Assert.assertEquals(null, test.getArgstring()); -414 Assert.assertEquals(null, test.getAbortedBy()); -415 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); -416 Assert.assertEquals("api-java-client-user-test1", test.getStartedBy()); -417 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -418 -419 } -420 @Test -421 @Betamax(tape = "trigger_job_as_user_unauthorized") -422 public void triggerJobDeprecatedAsUserUnauthorized() throws Exception { -423 RundeckClient client = createClient(TEST_TOKEN_3, 5); -424 -425 final RundeckExecution test; -426 try { -427 test = client.triggerJob("3170ba0e-6093-4b58-94d2-52988aefbfc9",null,null,"api-java-client-user-test2"); -428 Assert.fail("should not succeed"); -429 } catch (RundeckApiException e) { -430 Assert.assertEquals("Not authorized for action \"Run as User\" for Job ID 3170ba0e-6093-4b58-94d2-52988aefbfc9", e.getMessage()); -431 } -432 } -433 @Test -434 @Betamax(tape = "trigger_job_as_user_unauthorized") -435 public void triggerJobAsUserUnauthorized() throws Exception { -436 RundeckClient client = createClient(TEST_TOKEN_3, 5); -437 -438 final RundeckExecution test; -439 try { -440 test = client.triggerJob(RunJobBuilder.builder() -441 .setJobId("3170ba0e-6093-4b58-94d2-52988aefbfc9") -442 .setAsUser("api-java-client-user-test2") -443 .build()); -444 Assert.fail("should not succeed"); -445 } catch (RundeckApiException e) { -446 Assert.assertEquals("Not authorized for action \"Run as User\" for Job ID 3170ba0e-6093-4b58-94d2-52988aefbfc9", e.getMessage()); -447 } -448 } -449 -450 @Test -451 @Betamax(tape = "trigger_adhoc_command") -452 public void triggerAdhocCommandDeprecated() throws Exception { -453 RundeckClient client = createClient(TEST_TOKEN_3, 5); -454 -455 final RundeckExecution test -456 = client.triggerAdhocCommand("test", "echo test trigger_adhoc_command"); -457 -458 Assert.assertEquals((Long) 23L, test.getId()); -459 Assert.assertEquals(null, test.getArgstring()); -460 Assert.assertEquals(null, test.getAbortedBy()); -461 Assert.assertEquals("echo test trigger_adhoc_command", test.getDescription()); -462 Assert.assertEquals("admin", test.getStartedBy()); -463 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); -464 } -465 -466 @Test -467 @Betamax(tape = "trigger_adhoc_command") -468 public void triggerAdhocCommand() throws Exception { -469 RundeckClient client = createClient(TEST_TOKEN_3, 5); -470 -471 final RundeckExecution test -472 = client.triggerAdhocCommand(RunAdhocCommandBuilder.builder() -473 .setProject("test") -474 .setCommand("echo test trigger_adhoc_command") -475 .build()); -476 -477 Assert.assertEquals((Long) 23L, test.getId()); -478 Assert.assertEquals(null, test.getArgstring()); -479 Assert.assertEquals(null, test.getAbortedBy()); -480 Assert.assertEquals("echo test trigger_adhoc_command", test.getDescription()); -481 Assert.assertEquals("admin", test.getStartedBy()); -482 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); -483 } -484 -485 @Test -486 @Betamax(tape = "trigger_adhoc_command_as_user") -487 public void triggerAdhocCommandDeprecatedAsUser() throws Exception { -488 RundeckClient client = createClient(TEST_TOKEN_3, 5); -489 -490 final RundeckExecution test -491 = client.triggerAdhocCommand("test", "echo test trigger_adhoc_command_as_user",null,null,null,"api-java-client-test-run-command-as-user1"); -492 -493 Assert.assertEquals((Long) 24L, test.getId()); -494 Assert.assertEquals(null, test.getArgstring()); -495 Assert.assertEquals(null, test.getAbortedBy()); -496 Assert.assertEquals("echo test trigger_adhoc_command_as_user", test.getDescription()); -497 Assert.assertEquals("api-java-client-test-run-command-as-user1", test.getStartedBy()); -498 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); -499 } -500 @Test -501 @Betamax(tape = "trigger_adhoc_command_as_user") -502 public void triggerAdhocCommandAsUser() throws Exception { -503 RundeckClient client = createClient(TEST_TOKEN_3, 5); -504 -505 final RundeckExecution test -506 = client.triggerAdhocCommand( -507 RunAdhocCommandBuilder.builder() -508 .setProject("test") -509 .setCommand("echo test trigger_adhoc_command_as_user") -510 .setAsUser("api-java-client-test-run-command-as-user1") -511 .build() -512 ); -513 -514 Assert.assertEquals((Long) 24L, test.getId()); -515 Assert.assertEquals(null, test.getArgstring()); -516 Assert.assertEquals(null, test.getAbortedBy()); -517 Assert.assertEquals("echo test trigger_adhoc_command_as_user", test.getDescription()); -518 Assert.assertEquals("api-java-client-test-run-command-as-user1", test.getStartedBy()); -519 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); -520 } -521 @Test -522 @Betamax(tape = "trigger_adhoc_command_as_user_unauthorized") -523 public void triggerAdhocCommandDeprecatedAsUserUnauthorized() throws Exception { -524 RundeckClient client = createClient(TEST_TOKEN_3, 5); -525 -526 final RundeckExecution test; -527 try { -528 test = client.triggerAdhocCommand("test", "echo test trigger_adhoc_command_as_user",null,null,null,"api-java-client-test-run-command-as-user1"); -529 Assert.fail("should not succeed"); -530 } catch (RundeckApiException e) { -531 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); -532 } -533 } -534 @Test -535 @Betamax(tape = "trigger_adhoc_command_as_user_unauthorized") -536 public void triggerAdhocCommandAsUserUnauthorized() throws Exception { -537 RundeckClient client = createClient(TEST_TOKEN_3, 5); -538 -539 final RundeckExecution test; -540 try { -541 test = client.triggerAdhocCommand( -542 RunAdhocCommandBuilder.builder() -543 .setProject("test") -544 .setCommand("echo test trigger_adhoc_command_as_user") -545 .setAsUser("api-java-client-test-run-command-as-user1") -546 .build() -547 ); -548 Assert.fail("should not succeed"); -549 } catch (RundeckApiException e) { -550 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); -551 } -552 } -553 -554 @Test -555 @Betamax(tape = "trigger_adhoc_script") -556 public void triggerAdhocScriptDeprecated() throws Exception { -557 RundeckClient client = createClient(TEST_TOKEN_3, 5); -558 String script = "#!/bin/bash\n" + -559 "echo test trigger_adhoc_script\n"; -560 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -561 -562 final RundeckExecution test -563 = client.triggerAdhocScript("test", byteArrayInputStream,(Properties) null, null, null, null, null); -564 -565 Assert.assertEquals((Long) 25L, test.getId()); -566 Assert.assertEquals(null, test.getArgstring()); -567 Assert.assertEquals(null, test.getAbortedBy()); -568 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); -569 Assert.assertEquals("admin", test.getStartedBy()); -570 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -571 } -572 @Test -573 @Betamax(tape = "trigger_adhoc_script") -574 public void triggerAdhocScript() throws Exception { -575 RundeckClient client = createClient(TEST_TOKEN_3, 5); -576 String script = "#!/bin/bash\n" + -577 "echo test trigger_adhoc_script\n"; -578 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -579 -580 final RundeckExecution test -581 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript -582 (byteArrayInputStream).build()); -583 -584 Assert.assertEquals((Long) 25L, test.getId()); -585 Assert.assertEquals(null, test.getArgstring()); -586 Assert.assertEquals(null, test.getAbortedBy()); -587 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); -588 Assert.assertEquals("admin", test.getStartedBy()); -589 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -590 } -591 @Test -592 @Betamax(tape = "trigger_adhoc_script_as_user") -593 public void triggerAdhocScriptDeprecatedAsUser() throws Exception { -594 RundeckClient client = createClient(TEST_TOKEN_3, 5); -595 String script = "#!/bin/bash\n" + -596 "echo test trigger_adhoc_script\n"; -597 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -598 -599 final RundeckExecution test -600 = client.triggerAdhocScript("test", byteArrayInputStream, (Properties) null, null, null, null, "api-java-client-test-adhoc-script-as-user1"); -601 -602 Assert.assertEquals((Long) 26L, test.getId()); -603 Assert.assertEquals(null, test.getArgstring()); -604 Assert.assertEquals(null, test.getAbortedBy()); -605 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); -606 Assert.assertEquals("api-java-client-test-adhoc-script-as-user1", test.getStartedBy()); -607 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -608 } -609 @Test -610 @Betamax(tape = "trigger_adhoc_script_as_user") -611 public void triggerAdhocScriptAsUser() throws Exception { -612 RundeckClient client = createClient(TEST_TOKEN_3, 5); -613 String script = "#!/bin/bash\n" + -614 "echo test trigger_adhoc_script\n"; -615 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -616 -617 final RundeckExecution test -618 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript -619 (byteArrayInputStream).setAsUser("api-java-client-test-adhoc-script-as-user1").build()); -620 -621 Assert.assertEquals((Long) 26L, test.getId()); -622 Assert.assertEquals(null, test.getArgstring()); -623 Assert.assertEquals(null, test.getAbortedBy()); -624 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); -625 Assert.assertEquals("api-java-client-test-adhoc-script-as-user1", test.getStartedBy()); -626 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -627 } -628 @Test -629 @Betamax(tape = "trigger_adhoc_script_as_user_unauthorized") -630 public void triggerAdhocScriptDeprecatedAsUserUnauthorized() throws Exception { -631 RundeckClient client = createClient(TEST_TOKEN_3, 5); -632 String script = "#!/bin/bash\n" + -633 "echo test trigger_adhoc_script\n"; -634 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -635 -636 try{ -637 final RundeckExecution test -638 = client.triggerAdhocScript("test", byteArrayInputStream, (Properties) null, null, null, null, "api-java-client-test-adhoc-script-as-user1"); -639 Assert.fail("should not succeed"); -640 } catch (RundeckApiException e) { -641 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); -642 } -643 -644 } -645 @Test -646 @Betamax(tape = "trigger_adhoc_script_as_user_unauthorized") -647 public void triggerAdhocScriptAsUserUnauthorized() throws Exception { -648 RundeckClient client = createClient(TEST_TOKEN_3, 5); -649 String script = "#!/bin/bash\n" + -650 "echo test trigger_adhoc_script\n"; -651 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -652 -653 try{ -654 final RundeckExecution test -655 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript -656 (byteArrayInputStream).setAsUser("api-java-client-test-adhoc-script-as-user1").build()); -657 Assert.fail("should not succeed"); -658 } catch (RundeckApiException e) { -659 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); -660 } -661 -662 } +283 //FAKE results, testing paging attributes parsing +284 +285 //1 max, 1 offset +286 final PagedResults<RundeckExecution> test2 = client.getExecutions(ExecutionQuery.builder() +287 .project(projectName) +288 .excludeGroupPathExact("fruit") +289 .build(), 1L, 1L); +290 //expect no paging attributes +291 assertPageResults(test2, 2, -1, -1, -1, -1); +292 +293 //1 max, 2 offset +294 final PagedResults<RundeckExecution> test3 = client.getExecutions(ExecutionQuery.builder() +295 .project(projectName) +296 .excludeGroupPathExact("fruit") +297 .build(), 1L, 2L); +298 //invalid value for count +299 assertPageResults(test3, 2, -1, -1, -1, -1); +300 } +301 @Test +302 @Betamax(tape = "bulk_delete") +303 public void bulkDelete() throws Exception { +304 RundeckClient client = createClient(TEST_TOKEN_2, 5); +305 +306 final RundeckJobDeleteBulk deleteTest +307 = client.deleteJobs(Arrays.asList("0ce457b5-ba84-41ca-812e-02b31da355a4")); +308 Assert.assertTrue(deleteTest.isAllsuccessful()); +309 Assert.assertEquals(1, deleteTest.getRequestCount()); +310 Assert.assertEquals(1, deleteTest.getResults().size()); +311 +312 final RundeckJobDelete delete = deleteTest.getResults().get(0); +313 Assert.assertTrue(delete.isSuccessful()); +314 Assert.assertNull(delete.getError()); +315 Assert.assertNull(delete.getErrorCode()); +316 Assert.assertNotNull(delete.getMessage()); +317 Assert.assertEquals("0ce457b5-ba84-41ca-812e-02b31da355a4", delete.getId()); +318 } +319 @Test +320 @Betamax(tape = "bulk_delete_dne") +321 public void bulkDeleteFailDNE() throws Exception { +322 RundeckClient client = createClient(TEST_TOKEN_2, 5); +323 +324 final RundeckJobDeleteBulk deleteTest +325 = client.deleteJobs(Arrays.asList("does-not-exist")); +326 Assert.assertFalse(deleteTest.isAllsuccessful()); +327 Assert.assertEquals(1, deleteTest.getRequestCount()); +328 Assert.assertEquals(1, deleteTest.getResults().size()); +329 +330 final RundeckJobDelete delete = deleteTest.getResults().get(0); +331 Assert.assertFalse(delete.isSuccessful()); +332 Assert.assertNotNull(delete.getError()); +333 Assert.assertEquals("notfound", delete.getErrorCode()); +334 Assert.assertNull(delete.getMessage()); +335 Assert.assertEquals("does-not-exist", delete.getId()); +336 } +337 @Test +338 @Betamax(tape = "bulk_delete_unauthorized") +339 public void bulkDeleteFailUnauthorized() throws Exception { +340 RundeckClient client = createClient(TEST_TOKEN_2, 5); +341 +342 final RundeckJobDeleteBulk deleteTest +343 = client.deleteJobs(Arrays.asList("3a6d16be-4268-4d26-86a9-cebc1781f768")); +344 Assert.assertFalse(deleteTest.isAllsuccessful()); +345 Assert.assertEquals(1, deleteTest.getRequestCount()); +346 Assert.assertEquals(1, deleteTest.getResults().size()); +347 +348 final RundeckJobDelete delete = deleteTest.getResults().get(0); +349 Assert.assertFalse(delete.isSuccessful()); +350 Assert.assertNotNull(delete.getError()); +351 Assert.assertEquals("unauthorized", delete.getErrorCode()); +352 Assert.assertNull(delete.getMessage()); +353 Assert.assertEquals("3a6d16be-4268-4d26-86a9-cebc1781f768", delete.getId()); +354 } +355 @Test +356 @Betamax(tape = "trigger_job_basic") +357 public void triggerJobDeprecatedBasic() throws Exception { +358 RundeckClient client = createClient(TEST_TOKEN_3, 5); +359 +360 final RundeckExecution test +361 = client.triggerJob("3170ba0e-6093-4b58-94d2-52988aefbfc9", null, null, null); +362 +363 Assert.assertEquals((Long) 19L, test.getId()); +364 Assert.assertEquals(null, test.getArgstring()); +365 Assert.assertEquals(null, test.getAbortedBy()); +366 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); +367 Assert.assertEquals("admin", test.getStartedBy()); +368 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +369 +370 } +371 @Test +372 @Betamax(tape = "trigger_job_basic") +373 public void triggerJobBasic() throws Exception { +374 RundeckClient client = createClient(TEST_TOKEN_3, 5); +375 +376 final RundeckExecution test +377 = client.triggerJob(RunJobBuilder.builder().setJobId("3170ba0e-6093-4b58-94d2-52988aefbfc9").build()); +378 +379 Assert.assertEquals((Long) 19L, test.getId()); +380 Assert.assertEquals(null, test.getArgstring()); +381 Assert.assertEquals(null, test.getAbortedBy()); +382 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); +383 Assert.assertEquals("admin", test.getStartedBy()); +384 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +385 +386 } +387 @Test +388 @Betamax(tape = "trigger_job_as_user") +389 public void triggerJobDeprecatedAsUser() throws Exception { +390 RundeckClient client = createClient(TEST_TOKEN_3, 5); +391 +392 final RundeckExecution test +393 = client.triggerJob("3170ba0e-6093-4b58-94d2-52988aefbfc9", null, null, "api-java-client-user-test1"); +394 +395 Assert.assertEquals((Long) 20L, test.getId()); +396 Assert.assertEquals(null, test.getArgstring()); +397 Assert.assertEquals(null, test.getAbortedBy()); +398 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); +399 Assert.assertEquals("api-java-client-user-test1", test.getStartedBy()); +400 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +401 +402 } +403 @Test +404 @Betamax(tape = "trigger_job_as_user") +405 public void triggerJobAsUser() throws Exception { +406 RundeckClient client = createClient(TEST_TOKEN_3, 5); +407 +408 final RundeckExecution test +409 = client.triggerJob(RunJobBuilder.builder() +410 .setJobId("3170ba0e-6093-4b58-94d2-52988aefbfc9") +411 .setAsUser("api-java-client-user-test1") +412 .build()); +413 +414 Assert.assertEquals((Long)20L, test.getId()); +415 Assert.assertEquals(null, test.getArgstring()); +416 Assert.assertEquals(null, test.getAbortedBy()); +417 Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription()); +418 Assert.assertEquals("api-java-client-user-test1", test.getStartedBy()); +419 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +420 +421 } +422 @Test +423 @Betamax(tape = "trigger_job_as_user_unauthorized") +424 public void triggerJobDeprecatedAsUserUnauthorized() throws Exception { +425 RundeckClient client = createClient(TEST_TOKEN_3, 5); +426 +427 final RundeckExecution test; +428 try { +429 test = client.triggerJob("3170ba0e-6093-4b58-94d2-52988aefbfc9",null,null,"api-java-client-user-test2"); +430 Assert.fail("should not succeed"); +431 } catch (RundeckApiException e) { +432 Assert.assertEquals("Not authorized for action \"Run as User\" for Job ID 3170ba0e-6093-4b58-94d2-52988aefbfc9", e.getMessage()); +433 } +434 } +435 @Test +436 @Betamax(tape = "trigger_job_as_user_unauthorized") +437 public void triggerJobAsUserUnauthorized() throws Exception { +438 RundeckClient client = createClient(TEST_TOKEN_3, 5); +439 +440 final RundeckExecution test; +441 try { +442 test = client.triggerJob(RunJobBuilder.builder() +443 .setJobId("3170ba0e-6093-4b58-94d2-52988aefbfc9") +444 .setAsUser("api-java-client-user-test2") +445 .build()); +446 Assert.fail("should not succeed"); +447 } catch (RundeckApiException e) { +448 Assert.assertEquals("Not authorized for action \"Run as User\" for Job ID 3170ba0e-6093-4b58-94d2-52988aefbfc9", e.getMessage()); +449 } +450 } +451 +452 @Test +453 @Betamax(tape = "trigger_adhoc_command") +454 public void triggerAdhocCommandDeprecated() throws Exception { +455 RundeckClient client = createClient(TEST_TOKEN_3, 5); +456 +457 final RundeckExecution test +458 = client.triggerAdhocCommand("test", "echo test trigger_adhoc_command"); +459 +460 Assert.assertEquals((Long) 23L, test.getId()); +461 Assert.assertEquals(null, test.getArgstring()); +462 Assert.assertEquals(null, test.getAbortedBy()); +463 Assert.assertEquals("echo test trigger_adhoc_command", test.getDescription()); +464 Assert.assertEquals("admin", test.getStartedBy()); +465 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); +466 } +467 +468 @Test +469 @Betamax(tape = "trigger_adhoc_command") +470 public void triggerAdhocCommand() throws Exception { +471 RundeckClient client = createClient(TEST_TOKEN_3, 5); +472 +473 final RundeckExecution test +474 = client.triggerAdhocCommand(RunAdhocCommandBuilder.builder() +475 .setProject("test") +476 .setCommand("echo test trigger_adhoc_command") +477 .build()); +478 +479 Assert.assertEquals((Long) 23L, test.getId()); +480 Assert.assertEquals(null, test.getArgstring()); +481 Assert.assertEquals(null, test.getAbortedBy()); +482 Assert.assertEquals("echo test trigger_adhoc_command", test.getDescription()); +483 Assert.assertEquals("admin", test.getStartedBy()); +484 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); +485 } +486 +487 @Test +488 @Betamax(tape = "trigger_adhoc_command_as_user") +489 public void triggerAdhocCommandDeprecatedAsUser() throws Exception { +490 RundeckClient client = createClient(TEST_TOKEN_3, 5); +491 +492 final RundeckExecution test +493 = client.triggerAdhocCommand("test", "echo test trigger_adhoc_command_as_user",null,null,null,"api-java-client-test-run-command-as-user1"); +494 +495 Assert.assertEquals((Long) 24L, test.getId()); +496 Assert.assertEquals(null, test.getArgstring()); +497 Assert.assertEquals(null, test.getAbortedBy()); +498 Assert.assertEquals("echo test trigger_adhoc_command_as_user", test.getDescription()); +499 Assert.assertEquals("api-java-client-test-run-command-as-user1", test.getStartedBy()); +500 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); +501 } +502 @Test +503 @Betamax(tape = "trigger_adhoc_command_as_user") +504 public void triggerAdhocCommandAsUser() throws Exception { +505 RundeckClient client = createClient(TEST_TOKEN_3, 5); +506 +507 final RundeckExecution test +508 = client.triggerAdhocCommand( +509 RunAdhocCommandBuilder.builder() +510 .setProject("test") +511 .setCommand("echo test trigger_adhoc_command_as_user") +512 .setAsUser("api-java-client-test-run-command-as-user1") +513 .build() +514 ); +515 +516 Assert.assertEquals((Long) 24L, test.getId()); +517 Assert.assertEquals(null, test.getArgstring()); +518 Assert.assertEquals(null, test.getAbortedBy()); +519 Assert.assertEquals("echo test trigger_adhoc_command_as_user", test.getDescription()); +520 Assert.assertEquals("api-java-client-test-run-command-as-user1", test.getStartedBy()); +521 Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus()); +522 } +523 @Test +524 @Betamax(tape = "trigger_adhoc_command_as_user_unauthorized") +525 public void triggerAdhocCommandDeprecatedAsUserUnauthorized() throws Exception { +526 RundeckClient client = createClient(TEST_TOKEN_3, 5); +527 +528 final RundeckExecution test; +529 try { +530 test = client.triggerAdhocCommand("test", "echo test trigger_adhoc_command_as_user",null,null,null,"api-java-client-test-run-command-as-user1"); +531 Assert.fail("should not succeed"); +532 } catch (RundeckApiException e) { +533 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); +534 } +535 } +536 @Test +537 @Betamax(tape = "trigger_adhoc_command_as_user_unauthorized") +538 public void triggerAdhocCommandAsUserUnauthorized() throws Exception { +539 RundeckClient client = createClient(TEST_TOKEN_3, 5); +540 +541 final RundeckExecution test; +542 try { +543 test = client.triggerAdhocCommand( +544 RunAdhocCommandBuilder.builder() +545 .setProject("test") +546 .setCommand("echo test trigger_adhoc_command_as_user") +547 .setAsUser("api-java-client-test-run-command-as-user1") +548 .build() +549 ); +550 Assert.fail("should not succeed"); +551 } catch (RundeckApiException e) { +552 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); +553 } +554 } +555 +556 @Test +557 @Betamax(tape = "trigger_adhoc_script") +558 public void triggerAdhocScriptDeprecated() throws Exception { +559 RundeckClient client = createClient(TEST_TOKEN_3, 5); +560 String script = "#!/bin/bash\n" + +561 "echo test trigger_adhoc_script\n"; +562 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +563 +564 final RundeckExecution test +565 = client.triggerAdhocScript("test", byteArrayInputStream,(Properties) null, null, null, null, null); +566 +567 Assert.assertEquals((Long) 25L, test.getId()); +568 Assert.assertEquals(null, test.getArgstring()); +569 Assert.assertEquals(null, test.getAbortedBy()); +570 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); +571 Assert.assertEquals("admin", test.getStartedBy()); +572 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +573 } +574 @Test +575 @Betamax(tape = "trigger_adhoc_script") +576 public void triggerAdhocScript() throws Exception { +577 RundeckClient client = createClient(TEST_TOKEN_3, 5); +578 String script = "#!/bin/bash\n" + +579 "echo test trigger_adhoc_script\n"; +580 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +581 +582 final RundeckExecution test +583 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript +584 (byteArrayInputStream).build()); +585 +586 Assert.assertEquals((Long) 25L, test.getId()); +587 Assert.assertEquals(null, test.getArgstring()); +588 Assert.assertEquals(null, test.getAbortedBy()); +589 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); +590 Assert.assertEquals("admin", test.getStartedBy()); +591 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +592 } +593 @Test +594 @Betamax(tape = "trigger_adhoc_script_as_user") +595 public void triggerAdhocScriptDeprecatedAsUser() throws Exception { +596 RundeckClient client = createClient(TEST_TOKEN_3, 5); +597 String script = "#!/bin/bash\n" + +598 "echo test trigger_adhoc_script\n"; +599 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +600 +601 final RundeckExecution test +602 = client.triggerAdhocScript("test", byteArrayInputStream, (Properties) null, null, null, null, "api-java-client-test-adhoc-script-as-user1"); +603 +604 Assert.assertEquals((Long) 26L, test.getId()); +605 Assert.assertEquals(null, test.getArgstring()); +606 Assert.assertEquals(null, test.getAbortedBy()); +607 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); +608 Assert.assertEquals("api-java-client-test-adhoc-script-as-user1", test.getStartedBy()); +609 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +610 } +611 @Test +612 @Betamax(tape = "trigger_adhoc_script_as_user") +613 public void triggerAdhocScriptAsUser() throws Exception { +614 RundeckClient client = createClient(TEST_TOKEN_3, 5); +615 String script = "#!/bin/bash\n" + +616 "echo test trigger_adhoc_script\n"; +617 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +618 +619 final RundeckExecution test +620 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript +621 (byteArrayInputStream).setAsUser("api-java-client-test-adhoc-script-as-user1").build()); +622 +623 Assert.assertEquals((Long) 26L, test.getId()); +624 Assert.assertEquals(null, test.getArgstring()); +625 Assert.assertEquals(null, test.getAbortedBy()); +626 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); +627 Assert.assertEquals("api-java-client-test-adhoc-script-as-user1", test.getStartedBy()); +628 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +629 } +630 @Test +631 @Betamax(tape = "trigger_adhoc_script_as_user_unauthorized") +632 public void triggerAdhocScriptDeprecatedAsUserUnauthorized() throws Exception { +633 RundeckClient client = createClient(TEST_TOKEN_3, 5); +634 String script = "#!/bin/bash\n" + +635 "echo test trigger_adhoc_script\n"; +636 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +637 +638 try{ +639 final RundeckExecution test +640 = client.triggerAdhocScript("test", byteArrayInputStream, (Properties) null, null, null, null, "api-java-client-test-adhoc-script-as-user1"); +641 Assert.fail("should not succeed"); +642 } catch (RundeckApiException e) { +643 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); +644 } +645 +646 } +647 @Test +648 @Betamax(tape = "trigger_adhoc_script_as_user_unauthorized") +649 public void triggerAdhocScriptAsUserUnauthorized() throws Exception { +650 RundeckClient client = createClient(TEST_TOKEN_3, 5); +651 String script = "#!/bin/bash\n" + +652 "echo test trigger_adhoc_script\n"; +653 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +654 +655 try{ +656 final RundeckExecution test +657 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript +658 (byteArrayInputStream).setAsUser("api-java-client-test-adhoc-script-as-user1").build()); +659 Assert.fail("should not succeed"); +660 } catch (RundeckApiException e) { +661 Assert.assertEquals("Not authorized for action \"Run as User\" for Run Adhoc", e.getMessage()); +662 } 663 -664 @Test -665 @Betamax(tape = "trigger_adhoc_script_interpreter") -666 public void triggerAdhocScriptInpterpreter() throws Exception { -667 RundeckClient client = createClient(TEST_TOKEN_3, 8); -668 String script = "#!/bin/bash\n" + -669 "echo test trigger_adhoc_script\n"; -670 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); -671 final RundeckExecution test -672 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder() -673 .setProject("test").setScript(byteArrayInputStream) -674 .setScriptInterpreter("sudo -c bob") -675 .build()); -676 -677 Assert.assertEquals((Long) 27L, test.getId()); -678 Assert.assertEquals(null, test.getArgstring()); -679 Assert.assertEquals(null, test.getAbortedBy()); -680 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); -681 Assert.assertEquals("admin", test.getStartedBy()); -682 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); -683 } -684 @Test -685 @Betamax(tape = "abort_execution") -686 public void abortExecution() throws Exception { -687 RundeckClient client = createClient(TEST_TOKEN_3, 5); -688 -689 long executionId = 21L; -690 final RundeckAbort test = client.abortExecution(executionId); -691 -692 Assert.assertEquals((Long) executionId,test.getExecution().getId()); -693 Assert.assertEquals(RundeckAbort.AbortStatus.PENDING,test.getStatus()); -694 } -695 @Test -696 @Betamax(tape = "abort_execution_as_user") -697 public void abortExecutionAsUser() throws Exception { -698 RundeckClient client = createClient(TEST_TOKEN_3, 5); -699 -700 long executionId = 22L; -701 final RundeckAbort test = client.abortExecution(executionId,"api-java-client-test-abort-as-user1"); -702 -703 Assert.assertEquals((Long) executionId,test.getExecution().getId()); -704 Assert.assertEquals(RundeckAbort.AbortStatus.PENDING,test.getStatus()); -705 } -706 @Test -707 @Betamax(tape = "abort_execution_as_user_unauthorized") -708 public void abortExecutionAsUserUnauthorized() throws Exception { -709 RundeckClient client = createClient(TEST_TOKEN_3, 5); -710 -711 long executionId = 28L; -712 final RundeckAbort test = client.abortExecution(executionId, "api-java-client-test-abort-as-user1"); -713 Assert.assertEquals(RundeckAbort.AbortStatus.FAILED, test.getStatus()); -714 } -715 private void assertPageResults(PagedResults<RundeckExecution> jobTest, -716 final int size, -717 final int count, final int max, final int offset, final int total) { -718 Assert.assertEquals(size, jobTest.getResults().size()); -719 Assert.assertEquals(count, jobTest.getCount()); -720 Assert.assertEquals(max, jobTest.getMax()); -721 Assert.assertEquals(offset, jobTest.getOffset()); -722 Assert.assertEquals(total, jobTest.getTotal()); -723 } -724 -725 /** -726 * Import jobs, xml contains project context -727 * @throws Exception -728 */ -729 @Test -730 @Betamax(tape = "import_jobs_context_project") -731 public void importJobsContextProject() throws Exception { -732 final RundeckClient client = createClient(TEST_TOKEN_4, 8); -733 InputStream stream=new ByteArrayInputStream( -734 ("<joblist>\n" + -735 " <job>\n" + -736 " <loglevel>INFO</loglevel>\n" + -737 " <sequence keepgoing='false' strategy='node-first'>\n" + -738 " <command>\n" + -739 " <exec>echo hi</exec>\n" + -740 " </command>\n" + -741 " </sequence>\n" + -742 " <description></description>\n" + -743 " <name>job1</name>\n" + -744 " <context>\n" + -745 " <project>test</project>\n" + -746 " </context>\n" + -747 " </job>\n" + -748 "</joblist>").getBytes("utf-8")); -749 -750 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() -751 .setStream(stream) -752 .setFileType(FileType.XML) -753 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) -754 .build(); -755 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); -756 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); -757 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); -758 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); -759 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); -760 Assert.assertEquals("job1", rundeckJob.getName()); -761 Assert.assertEquals("test", rundeckJob.getProject()); -762 } -763 /** -764 * Import jobs, xml no project defined -765 * @throws Exception -766 */ -767 @Test -768 @Betamax(tape = "import_jobs_no_project") -769 public void importJobsNoProject() throws Exception { -770 final RundeckClient client = createClient(TEST_TOKEN_4, 8); -771 InputStream stream=new ByteArrayInputStream( -772 ("<joblist>\n" + -773 " <job>\n" + -774 " <loglevel>INFO</loglevel>\n" + -775 " <sequence keepgoing='false' strategy='node-first'>\n" + -776 " <command>\n" + -777 " <exec>echo hi</exec>\n" + -778 " </command>\n" + -779 " </sequence>\n" + -780 " <description></description>\n" + -781 " <name>job2</name>\n" + -782 " </job>\n" + -783 "</joblist>").getBytes("utf-8")); -784 -785 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() -786 .setStream(stream) -787 .setFileType(FileType.XML) -788 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) -789 .build(); -790 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); -791 Assert.assertEquals(1,rundeckJobsImportResult.getFailedJobs().size()); -792 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); -793 Assert.assertEquals(0,rundeckJobsImportResult.getSucceededJobs().size()); -794 RundeckJob rundeckJob = rundeckJobsImportResult.getFailedJobs().entrySet().iterator().next().getKey(); -795 String reason = rundeckJobsImportResult.getFailedJobs().get(rundeckJob); -796 Assert.assertEquals("job2", rundeckJob.getName()); -797 Assert.assertEquals(null, rundeckJob.getProject()); -798 Assert.assertTrue(reason.contains("Project was not specified")); -799 } -800 /** -801 * Import jobs, using project parameter -802 * @throws Exception -803 */ -804 @Test -805 @Betamax(tape = "import_jobs_project_param") -806 public void importJobsProjectParam() throws Exception { -807 final RundeckClient client = createClient(TEST_TOKEN_4, 8); -808 InputStream stream=new ByteArrayInputStream( -809 ("<joblist>\n" + -810 " <job>\n" + -811 " <loglevel>INFO</loglevel>\n" + -812 " <sequence keepgoing='false' strategy='node-first'>\n" + -813 " <command>\n" + -814 " <exec>echo hi</exec>\n" + -815 " </command>\n" + -816 " </sequence>\n" + -817 " <description></description>\n" + -818 " <name>importJobsProjectParam</name>\n" + -819 " </job>\n" + -820 "</joblist>").getBytes("utf-8")); -821 -822 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() -823 .setStream(stream) -824 .setFileType(FileType.XML) -825 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) -826 .setProject("test") -827 .build(); -828 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); -829 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); -830 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); -831 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); -832 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); -833 Assert.assertEquals("importJobsProjectParam", rundeckJob.getName()); -834 Assert.assertEquals("test", rundeckJob.getProject()); -835 } -836 /** -837 * Import jobs, project parameter overrides xml -838 * @throws Exception -839 */ -840 @Test -841 @Betamax(tape = "import_jobs_project_param_override") -842 public void importJobsProjectParamOverride() throws Exception { -843 final RundeckClient client = createClient(TEST_TOKEN_4, 8); -844 InputStream stream=new ByteArrayInputStream( -845 ("<joblist>\n" + -846 " <job>\n" + -847 " <loglevel>INFO</loglevel>\n" + -848 " <sequence keepgoing='false' strategy='node-first'>\n" + -849 " <command>\n" + -850 " <exec>echo hi</exec>\n" + -851 " </command>\n" + -852 " </sequence>\n" + -853 " <description></description>\n" + -854 " <name>importJobsProjectParamOverride</name>\n" + -855 " <context>\n" + -856 " <project>testXYZ</project>\n" + -857 " </context>\n" + -858 " </job>\n" + -859 "</joblist>").getBytes("utf-8")); -860 -861 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() -862 .setStream(stream) -863 .setFileType(FileType.XML) -864 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) -865 .setProject("test") -866 .build(); -867 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); -868 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); -869 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); -870 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); -871 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); -872 Assert.assertEquals("importJobsProjectParamOverride", rundeckJob.getName()); -873 Assert.assertEquals("test", rundeckJob.getProject()); -874 } -875 /** -876 * Import jobs, project parameter v7 doesn' use parameter -877 * @throws Exception -878 */ -879 @Test -880 @Betamax(tape = "import_jobs_project_param_v7") -881 public void importJobsProjectParamV7() throws Exception { -882 final RundeckClient client = createClient(TEST_TOKEN_4, 7); -883 InputStream stream=new ByteArrayInputStream( -884 ("<joblist>\n" + -885 " <job>\n" + -886 " <loglevel>INFO</loglevel>\n" + -887 " <sequence keepgoing='false' strategy='node-first'>\n" + -888 " <command>\n" + -889 " <exec>echo hi</exec>\n" + -890 " </command>\n" + -891 " </sequence>\n" + -892 " <description></description>\n" + -893 " <name>importJobsProjectParamV7</name>\n" + -894 " <context>\n" + -895 " <project>testXYZ</project>\n" + -896 " </context>\n" + -897 " </job>\n" + -898 "</joblist>").getBytes("utf-8")); -899 -900 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() -901 .setStream(stream) -902 .setFileType(FileType.XML) -903 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) -904 .setProject("test") -905 .build(); -906 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); -907 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); -908 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); -909 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); -910 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); -911 Assert.assertEquals("importJobsProjectParamV7", rundeckJob.getName()); -912 Assert.assertEquals("testXYZ", rundeckJob.getProject()); -913 } -914 -915 @Before -916 public void setUp() throws Exception { -917 // not that you can put whatever here, because we don't actually connect to the RunDeck instance -918 // but instead use betamax as a proxy to serve the previously recorded tapes (in src/test/resources) -919 client = createClient(TEST_TOKEN_0, 5); -920 } -921 -922 private RundeckClient createClient(final String token, int version) { -923 return createBuilder(token).version(version).build(); -924 } -925 -926 private RundeckClient createClient(String token) { -927 return createBuilder(token) -928 .build(); -929 } -930 -931 private RundeckClientBuilder createBuilder(String token) { -932 return RundeckClient.builder().url("http://rundeck.local:4440") -933 .token(token); -934 } -935 -936 } +664 } +665 +666 @Test +667 @Betamax(tape = "trigger_adhoc_script_interpreter") +668 public void triggerAdhocScriptInpterpreter() throws Exception { +669 RundeckClient client = createClient(TEST_TOKEN_3, 8); +670 String script = "#!/bin/bash\n" + +671 "echo test trigger_adhoc_script\n"; +672 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes()); +673 final RundeckExecution test +674 = client.triggerAdhocScript(RunAdhocScriptBuilder.builder() +675 .setProject("test").setScript(byteArrayInputStream) +676 .setScriptInterpreter("sudo -c bob") +677 .build()); +678 +679 Assert.assertEquals((Long) 27L, test.getId()); +680 Assert.assertEquals(null, test.getArgstring()); +681 Assert.assertEquals(null, test.getAbortedBy()); +682 Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription()); +683 Assert.assertEquals("admin", test.getStartedBy()); +684 Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus()); +685 } +686 @Test +687 @Betamax(tape = "abort_execution") +688 public void abortExecution() throws Exception { +689 RundeckClient client = createClient(TEST_TOKEN_3, 5); +690 +691 long executionId = 21L; +692 final RundeckAbort test = client.abortExecution(executionId); +693 +694 Assert.assertEquals((Long) executionId,test.getExecution().getId()); +695 Assert.assertEquals(RundeckAbort.AbortStatus.PENDING,test.getStatus()); +696 } +697 @Test +698 @Betamax(tape = "abort_execution_as_user") +699 public void abortExecutionAsUser() throws Exception { +700 RundeckClient client = createClient(TEST_TOKEN_3, 5); +701 +702 long executionId = 22L; +703 final RundeckAbort test = client.abortExecution(executionId,"api-java-client-test-abort-as-user1"); +704 +705 Assert.assertEquals((Long) executionId,test.getExecution().getId()); +706 Assert.assertEquals(RundeckAbort.AbortStatus.PENDING,test.getStatus()); +707 } +708 @Test +709 @Betamax(tape = "abort_execution_as_user_unauthorized") +710 public void abortExecutionAsUserUnauthorized() throws Exception { +711 RundeckClient client = createClient(TEST_TOKEN_3, 5); +712 +713 long executionId = 28L; +714 final RundeckAbort test = client.abortExecution(executionId, "api-java-client-test-abort-as-user1"); +715 Assert.assertEquals(RundeckAbort.AbortStatus.FAILED, test.getStatus()); +716 } +717 private void assertPageResults(PagedResults<RundeckExecution> jobTest, +718 final int size, +719 final int count, final int max, final int offset, final int total) { +720 Assert.assertEquals(size, jobTest.getResults().size()); +721 Assert.assertEquals(count, jobTest.getCount()); +722 Assert.assertEquals(max, jobTest.getMax()); +723 Assert.assertEquals(offset, jobTest.getOffset()); +724 Assert.assertEquals(total, jobTest.getTotal()); +725 } +726 +727 /** +728 * Import jobs, xml contains project context +729 * @throws Exception +730 */ +731 @Test +732 @Betamax(tape = "import_jobs_context_project") +733 public void importJobsContextProject() throws Exception { +734 final RundeckClient client = createClient(TEST_TOKEN_4, 8); +735 InputStream stream=new ByteArrayInputStream( +736 ("<joblist>\n" + +737 " <job>\n" + +738 " <loglevel>INFO</loglevel>\n" + +739 " <sequence keepgoing='false' strategy='node-first'>\n" + +740 " <command>\n" + +741 " <exec>echo hi</exec>\n" + +742 " </command>\n" + +743 " </sequence>\n" + +744 " <description></description>\n" + +745 " <name>job1</name>\n" + +746 " <context>\n" + +747 " <project>test</project>\n" + +748 " </context>\n" + +749 " </job>\n" + +750 "</joblist>").getBytes("utf-8")); +751 +752 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +753 .setStream(stream) +754 .setFileType(FileType.XML) +755 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +756 .build(); +757 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +758 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); +759 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +760 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); +761 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); +762 Assert.assertEquals("job1", rundeckJob.getName()); +763 Assert.assertEquals("test", rundeckJob.getProject()); +764 } +765 /** +766 * Import jobs, xml no project defined +767 * @throws Exception +768 */ +769 @Test +770 @Betamax(tape = "import_jobs_no_project") +771 public void importJobsNoProject() throws Exception { +772 final RundeckClient client = createClient(TEST_TOKEN_4, 8); +773 InputStream stream=new ByteArrayInputStream( +774 ("<joblist>\n" + +775 " <job>\n" + +776 " <loglevel>INFO</loglevel>\n" + +777 " <sequence keepgoing='false' strategy='node-first'>\n" + +778 " <command>\n" + +779 " <exec>echo hi</exec>\n" + +780 " </command>\n" + +781 " </sequence>\n" + +782 " <description></description>\n" + +783 " <name>job2</name>\n" + +784 " </job>\n" + +785 "</joblist>").getBytes("utf-8")); +786 +787 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +788 .setStream(stream) +789 .setFileType(FileType.XML) +790 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +791 .build(); +792 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +793 Assert.assertEquals(1,rundeckJobsImportResult.getFailedJobs().size()); +794 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +795 Assert.assertEquals(0,rundeckJobsImportResult.getSucceededJobs().size()); +796 RundeckJob rundeckJob = rundeckJobsImportResult.getFailedJobs().entrySet().iterator().next().getKey(); +797 String reason = rundeckJobsImportResult.getFailedJobs().get(rundeckJob); +798 Assert.assertEquals("job2", rundeckJob.getName()); +799 Assert.assertEquals(null, rundeckJob.getProject()); +800 Assert.assertTrue(reason.contains("Project was not specified")); +801 } +802 /** +803 * Import jobs, using project parameter +804 * @throws Exception +805 */ +806 @Test +807 @Betamax(tape = "import_jobs_project_param") +808 public void importJobsProjectParam() throws Exception { +809 final RundeckClient client = createClient(TEST_TOKEN_4, 8); +810 InputStream stream=new ByteArrayInputStream( +811 ("<joblist>\n" + +812 " <job>\n" + +813 " <loglevel>INFO</loglevel>\n" + +814 " <sequence keepgoing='false' strategy='node-first'>\n" + +815 " <command>\n" + +816 " <exec>echo hi</exec>\n" + +817 " </command>\n" + +818 " </sequence>\n" + +819 " <description></description>\n" + +820 " <name>importJobsProjectParam</name>\n" + +821 " </job>\n" + +822 "</joblist>").getBytes("utf-8")); +823 +824 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +825 .setStream(stream) +826 .setFileType(FileType.XML) +827 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +828 .setProject("test") +829 .build(); +830 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +831 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); +832 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +833 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); +834 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); +835 Assert.assertEquals("importJobsProjectParam", rundeckJob.getName()); +836 Assert.assertEquals("test", rundeckJob.getProject()); +837 } +838 /** +839 * Import jobs, project parameter overrides xml +840 * @throws Exception +841 */ +842 @Test +843 @Betamax(tape = "import_jobs_project_param_override") +844 public void importJobsProjectParamOverride() throws Exception { +845 final RundeckClient client = createClient(TEST_TOKEN_4, 8); +846 InputStream stream=new ByteArrayInputStream( +847 ("<joblist>\n" + +848 " <job>\n" + +849 " <loglevel>INFO</loglevel>\n" + +850 " <sequence keepgoing='false' strategy='node-first'>\n" + +851 " <command>\n" + +852 " <exec>echo hi</exec>\n" + +853 " </command>\n" + +854 " </sequence>\n" + +855 " <description></description>\n" + +856 " <name>importJobsProjectParamOverride</name>\n" + +857 " <context>\n" + +858 " <project>testXYZ</project>\n" + +859 " </context>\n" + +860 " </job>\n" + +861 "</joblist>").getBytes("utf-8")); +862 +863 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +864 .setStream(stream) +865 .setFileType(FileType.XML) +866 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +867 .setProject("test") +868 .build(); +869 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +870 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); +871 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +872 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); +873 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); +874 Assert.assertEquals("importJobsProjectParamOverride", rundeckJob.getName()); +875 Assert.assertEquals("test", rundeckJob.getProject()); +876 } +877 /** +878 * Import jobs, project parameter v7 doesn' use parameter +879 * @throws Exception +880 */ +881 @Test +882 @Betamax(tape = "import_jobs_project_param_v7") +883 public void importJobsProjectParamV7() throws Exception { +884 final RundeckClient client = createClient(TEST_TOKEN_4, 7); +885 InputStream stream=new ByteArrayInputStream( +886 ("<joblist>\n" + +887 " <job>\n" + +888 " <loglevel>INFO</loglevel>\n" + +889 " <sequence keepgoing='false' strategy='node-first'>\n" + +890 " <command>\n" + +891 " <exec>echo hi</exec>\n" + +892 " </command>\n" + +893 " </sequence>\n" + +894 " <description></description>\n" + +895 " <name>importJobsProjectParamV7</name>\n" + +896 " <context>\n" + +897 " <project>testXYZ</project>\n" + +898 " </context>\n" + +899 " </job>\n" + +900 "</joblist>").getBytes("utf-8")); +901 +902 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +903 .setStream(stream) +904 .setFileType(FileType.XML) +905 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +906 .setProject("test") +907 .build(); +908 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +909 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); +910 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +911 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); +912 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); +913 Assert.assertEquals("importJobsProjectParamV7", rundeckJob.getName()); +914 Assert.assertEquals("testXYZ", rundeckJob.getProject()); +915 } +916 /** +917 * Import jobs, project parameter v7 doesn' use parameter +918 * @throws Exception +919 */ +920 @Test +921 @Betamax(tape = "import_jobs_uuid_param_remove_v9") +922 public void importJobsUUIDParamRemoveV9() throws Exception { +923 final RundeckClient client = createClient(TEST_TOKEN_6, 9); +924 InputStream stream=new ByteArrayInputStream( +925 ("<joblist>\n" + +926 " <job>\n" + +927 " <uuid>testImportUUID</uuid>\n" + +928 " <loglevel>INFO</loglevel>\n" + +929 " <sequence keepgoing='false' strategy='node-first'>\n" + +930 " <command>\n" + +931 " <exec>echo hi</exec>\n" + +932 " </command>\n" + +933 " </sequence>\n" + +934 " <description></description>\n" + +935 " <name>importJobsUUIDParamRemoveV9</name>\n" + +936 " </job>\n" + +937 "</joblist>").getBytes("utf-8")); +938 +939 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +940 .setStream(stream) +941 .setFileType(FileType.XML) +942 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +943 .setUUIDImportBehavior(RundeckJobsUUIDImportBehavior.REMOVE) +944 .setProject("test") +945 .build(); +946 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +947 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); +948 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +949 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); +950 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); +951 Assert.assertEquals("importJobsUUIDParamRemoveV9", rundeckJob.getName()); +952 Assert.assertFalse("testImportUUID".equals(rundeckJob.getId())); +953 Assert.assertEquals("b33c8bb1-4dfc-4661-a890-4164b264cc4a", rundeckJob.getId()); +954 } +955 /** +956 * Import jobs, project parameter v7 doesn' use parameter +957 * @throws Exception +958 */ +959 @Test +960 @Betamax(tape = "import_jobs_uuid_param_preserve_v9") +961 public void importJobsUUIDParamPreserveV9() throws Exception { +962 final RundeckClient client = createClient(TEST_TOKEN_6, 9); +963 InputStream stream=new ByteArrayInputStream( +964 ("<joblist>\n" + +965 " <job>\n" + +966 " <uuid>testImportUUID</uuid>\n" + +967 " <loglevel>INFO</loglevel>\n" + +968 " <sequence keepgoing='false' strategy='node-first'>\n" + +969 " <command>\n" + +970 " <exec>echo hi</exec>\n" + +971 " </command>\n" + +972 " </sequence>\n" + +973 " <description></description>\n" + +974 " <name>importJobsUUIDParamPreserveV9</name>\n" + +975 " </job>\n" + +976 "</joblist>").getBytes("utf-8")); +977 +978 final RundeckJobsImport jobsImport = RundeckJobsImportBuilder.builder() +979 .setStream(stream) +980 .setFileType(FileType.XML) +981 .setJobsImportMethod(RundeckJobsImportMethod.CREATE) +982 .setUUIDImportBehavior(RundeckJobsUUIDImportBehavior.PRESERVE) +983 .setProject("test") +984 .build(); +985 RundeckJobsImportResult rundeckJobsImportResult = client.importJobs(jobsImport); +986 Assert.assertEquals(0,rundeckJobsImportResult.getFailedJobs().size()); +987 Assert.assertEquals(0,rundeckJobsImportResult.getSkippedJobs().size()); +988 Assert.assertEquals(1,rundeckJobsImportResult.getSucceededJobs().size()); +989 RundeckJob rundeckJob = rundeckJobsImportResult.getSucceededJobs().get(0); +990 Assert.assertEquals("importJobsUUIDParamPreserveV9", rundeckJob.getName()); +991 Assert.assertEquals("testImportUUID", rundeckJob.getId()); +992 } +993 /** +994 * Running executions for all projects using API v9 +995 * @throws Exception +996 */ +997 @Test +998 @Betamax(tape = "running_executions_v9") +999 public void runningExecutionsV9() throws Exception { +1000 final RundeckClient client = createClient(TEST_TOKEN_5, 9); +1001 List<RundeckExecution> runningExecutions = client.getRunningExecutions(); +1002 Assert.assertEquals(2, runningExecutions.size()); +1003 RundeckExecution exec1 = runningExecutions.get(0); +1004 Assert.assertEquals("test", exec1.getProject()); +1005 RundeckExecution exec2 = runningExecutions.get(1); +1006 Assert.assertEquals("test2", exec2.getProject()); +1007 } +1008 +1009 /** +1010 * Running executions for all projects using API v8, which queries for project list and then individually +1011 * queries each project's now running +1012 * @throws Exception +1013 */ +1014 @Test +1015 @Betamax(tape = "running_executions_v8") +1016 public void runningExecutionsV8() throws Exception { +1017 final RundeckClient client = createClient(TEST_TOKEN_5, 8); +1018 List<RundeckExecution> runningExecutions = client.getRunningExecutions(); +1019 Assert.assertEquals(2, runningExecutions.size()); +1020 RundeckExecution exec1 = runningExecutions.get(0); +1021 Assert.assertEquals("test", exec1.getProject()); +1022 RundeckExecution exec2 = runningExecutions.get(1); +1023 Assert.assertEquals("test2", exec2.getProject()); +1024 } +1025 +1026 @Before +1027 public void setUp() throws Exception { +1028 // not that you can put whatever here, because we don't actually connect to the RunDeck instance +1029 // but instead use betamax as a proxy to serve the previously recorded tapes (in src/test/resources) +1030 client = createClient(TEST_TOKEN_0, 5); +1031 } +1032 +1033 private RundeckClient createClient(final String token, int version) { +1034 return createBuilder(token).version(version).build(); +1035 } +1036 +1037 private RundeckClient createClient(String token) { +1038 return createBuilder(token) +1039 .build(); +1040 } +1041 +1042 private RundeckClientBuilder createBuilder(String token) { +1043 return RundeckClient.builder().url("http://rundeck.local:4440") +1044 .token(token); +1045 } +1046 +1047 }
    diff --git a/xref-test/org/rundeck/api/package-frame.html b/xref-test/org/rundeck/api/package-frame.html index 3d9f170..7875371 100644 --- a/xref-test/org/rundeck/api/package-frame.html +++ b/xref-test/org/rundeck/api/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api diff --git a/xref-test/org/rundeck/api/package-summary.html b/xref-test/org/rundeck/api/package-summary.html index c4f5cf7..5c352a4 100644 --- a/xref-test/org/rundeck/api/package-summary.html +++ b/xref-test/org/rundeck/api/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api @@ -62,6 +62,6 @@

    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref-test/org/rundeck/api/parser/ExecutionParserTest.html b/xref-test/org/rundeck/api/parser/ExecutionParserTest.html index 649084f..60ad50c 100644 --- a/xref-test/org/rundeck/api/parser/ExecutionParserTest.html +++ b/xref-test/org/rundeck/api/parser/ExecutionParserTest.html @@ -141,7 +141,32 @@ 131 Assert.assertNull(job); 132 } 133 -134 } +134 @Test +135 public void parseV9Execution() throws Exception { +136 InputStream input = getClass().getResourceAsStream("execution-running-v9.xml"); +137 Document document = ParserHelper.loadDocument(input); +138 +139 RundeckExecution execution = new ExecutionParser("result/executions/execution").parseXmlNode(document); +140 RundeckJob job = execution.getJob(); +141 +142 Assert.assertEquals(null, job); +143 Assert.assertEquals(new Long(119), execution.getId()); +144 Assert.assertEquals("http://localhost:4440/execution/follow/119", execution.getUrl()); +145 Assert.assertEquals(ExecutionStatus.RUNNING, execution.getStatus()); +146 Assert.assertEquals("admin", execution.getStartedBy()); +147 Assert.assertEquals(new Date(1377104570966L), execution.getStartedAt()); +148 Assert.assertEquals(null, execution.getEndedAt()); +149 Assert.assertEquals(null, execution.getDurationInMillis()); +150 Assert.assertEquals(null, execution.getDuration()); +151 Assert.assertEquals(null, execution.getAbortedBy()); +152 Assert.assertEquals("echo asdf; sleep 120", execution.getDescription()); +153 Assert.assertEquals(null, execution.getArgstring()); +154 Assert.assertEquals("test", execution.getProject()); +155 +156 +157 } +158 +159 }
    diff --git a/xref-test/org/rundeck/api/parser/package-frame.html b/xref-test/org/rundeck/api/parser/package-frame.html index 6e6ab63..ea5dfb5 100644 --- a/xref-test/org/rundeck/api/parser/package-frame.html +++ b/xref-test/org/rundeck/api/parser/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.parser + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.parser diff --git a/xref-test/org/rundeck/api/parser/package-summary.html b/xref-test/org/rundeck/api/parser/package-summary.html index 6e982e0..c52e799 100644 --- a/xref-test/org/rundeck/api/parser/package-summary.html +++ b/xref-test/org/rundeck/api/parser/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.parser + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.parser @@ -127,6 +127,6 @@

    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref-test/org/rundeck/api/util/package-frame.html b/xref-test/org/rundeck/api/util/package-frame.html index 278f96f..8386b6b 100644 --- a/xref-test/org/rundeck/api/util/package-frame.html +++ b/xref-test/org/rundeck/api/util/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.util + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.util diff --git a/xref-test/org/rundeck/api/util/package-summary.html b/xref-test/org/rundeck/api/util/package-summary.html index 4eb2994..92e715d 100644 --- a/xref-test/org/rundeck/api/util/package-summary.html +++ b/xref-test/org/rundeck/api/util/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.util + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.util @@ -62,6 +62,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref-test/overview-frame.html b/xref-test/overview-frame.html index aea9d85..856e1b4 100644 --- a/xref-test/overview-frame.html +++ b/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference + RunDeck API - Java Client 9.2-SNAPSHOT Reference diff --git a/xref-test/overview-summary.html b/xref-test/overview-summary.html index 8e9f6db..cf26b9b 100644 --- a/xref-test/overview-summary.html +++ b/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference + RunDeck API - Java Client 9.2-SNAPSHOT Reference @@ -24,7 +24,7 @@ -

    RunDeck API - Java Client 8.0 Reference

    +

    RunDeck API - Java Client 9.2-SNAPSHOT Reference

    @@ -69,6 +69,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref/allclasses-frame.html b/xref/allclasses-frame.html index 2b54d99..1a71091 100644 --- a/xref/allclasses-frame.html +++ b/xref/allclasses-frame.html @@ -196,6 +196,9 @@
  • RundeckJobsImportResult +
  • +
  • + RundeckJobsUUIDImportBehavior
  • RundeckLogLevel diff --git a/xref/index.html b/xref/index.html index b1874b6..5169ac7 100644 --- a/xref/index.html +++ b/xref/index.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference + RunDeck API - Java Client 9.2-SNAPSHOT Reference diff --git a/xref/org/rundeck/api/DefaultJobsImport.html b/xref/org/rundeck/api/DefaultJobsImport.html index 58badf4..9154195 100644 --- a/xref/org/rundeck/api/DefaultJobsImport.html +++ b/xref/org/rundeck/api/DefaultJobsImport.html @@ -11,50 +11,60 @@ 1 package org.rundeck.api; 2 3 import org.rundeck.api.domain.RundeckJobsImportMethod; -4 -5 import java.io.InputStream; -6 -7 /** -8 * $INTERFACE is ... User: greg Date: 8/6/13 Time: 10:18 AM -9 */ -10 public class DefaultJobsImport implements RundeckJobsImport{ -11 private InputStream stream; -12 private FileType fileType; -13 private RundeckJobsImportMethod importMethod; -14 private String project; -15 -16 public InputStream getStream() { -17 return stream; -18 } -19 -20 public void setStream(final InputStream stream) { -21 this.stream = stream; -22 } -23 -24 public FileType getFileType() { -25 return fileType; -26 } -27 -28 public void setFileType(final FileType fileType) { -29 this.fileType = fileType; -30 } -31 -32 public RundeckJobsImportMethod getImportMethod() { -33 return importMethod; -34 } -35 -36 public void setImportMethod(final RundeckJobsImportMethod importMethod) { -37 this.importMethod = importMethod; -38 } -39 -40 public String getProject() { -41 return project; -42 } -43 -44 public void setProject(final String project) { -45 this.project = project; -46 } -47 } +4 import org.rundeck.api.domain.RundeckJobsUUIDImportBehavior; +5 +6 import java.io.InputStream; +7 +8 /** +9 * $INTERFACE is ... User: greg Date: 8/6/13 Time: 10:18 AM +10 */ +11 public class DefaultJobsImport implements RundeckJobsImport{ +12 private InputStream stream; +13 private FileType fileType; +14 private RundeckJobsImportMethod importMethod; +15 private RundeckJobsUUIDImportBehavior uuidImportBehavior; +16 private String project; +17 +18 public InputStream getStream() { +19 return stream; +20 } +21 +22 public void setStream(final InputStream stream) { +23 this.stream = stream; +24 } +25 +26 public FileType getFileType() { +27 return fileType; +28 } +29 +30 public void setFileType(final FileType fileType) { +31 this.fileType = fileType; +32 } +33 +34 public RundeckJobsImportMethod getImportMethod() { +35 return importMethod; +36 } +37 +38 public void setImportMethod(final RundeckJobsImportMethod importMethod) { +39 this.importMethod = importMethod; +40 } +41 +42 public String getProject() { +43 return project; +44 } +45 +46 public void setProject(final String project) { +47 this.project = project; +48 } +49 +50 public RundeckJobsUUIDImportBehavior getUuidImportBehavior() { +51 return uuidImportBehavior; +52 } +53 +54 public void setUuidImportBehavior(RundeckJobsUUIDImportBehavior uuidImportBehavior) { +55 this.uuidImportBehavior = uuidImportBehavior; +56 } +57 }
    diff --git a/xref/org/rundeck/api/RundeckClient.html b/xref/org/rundeck/api/RundeckClient.html index 3088278..31040ec 100644 --- a/xref/org/rundeck/api/RundeckClient.html +++ b/xref/org/rundeck/api/RundeckClient.html @@ -110,3306 +110,3316 @@ 100 V6(6), 101 V7(7), 102 V8(8), -103 ; -104 -105 private int versionNumber; -106 -107 Version(final int i) { -108 versionNumber = i; -109 } -110 -111 public int getVersionNumber() { -112 return versionNumber; -113 } -114 } -115 /** Version of the API supported */ -116 public static final transient int API_VERSION = Version.V8.getVersionNumber(); -117 -118 private static final String API = "/api/"; -119 -120 /** End-point of the API */ -121 public static final transient String API_ENDPOINT = API + API_VERSION; -122 -123 /** Default value for the "pooling interval" used when running jobs/commands/scripts */ -124 private static final transient long DEFAULT_POOLING_INTERVAL = 5; -125 -126 /** Default unit of the "pooling interval" used when running jobs/commands/scripts */ -127 private static final transient TimeUnit DEFAULT_POOLING_UNIT = TimeUnit.SECONDS; -128 -129 /** URL of the RunDeck instance ("http://localhost:4440" target="alexandria_uri">http://localhost:4440", "http://rundeck.your-compagny.com/", etc) */ -130 private final String url; -131 -132 private int apiVersion = API_VERSION; -133 -134 private String token; -135 -136 private String login; -137 -138 private String password; -139 -140 private String sessionID; -141 -142 void setToken(String token) { -143 this.token = token; -144 } -145 -146 void setLogin(String login) { -147 this.login = login; -148 } -149 -150 void setPassword(String password) { -151 this.password = password; -152 } -153 -154 void setSessionID(String sessionID) { -155 this.sessionID = sessionID; -156 } -157 -158 int getApiVersion() { -159 return apiVersion; -160 } -161 -162 void setApiVersion(int apiVersion) { -163 this.apiVersion = apiVersion; -164 } -165 -166 void setApiVersion(Version apiVersion) { -167 this.apiVersion = apiVersion.getVersionNumber(); -168 } -169 -170 String getApiEndpoint() { -171 return API + getApiVersion(); -172 } -173 -174 /** -175 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url, using login-based -176 * authentication. -177 * -178 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) -179 * @param login to use for authentication on the RunDeck instance -180 * @param password to use for authentication on the RunDeck instance -181 * @throws IllegalArgumentException if the url, login or password is blank (null, empty or whitespace) -182 */ -183 public RundeckClient(String url, String login, String password) throws IllegalArgumentException { -184 this(url); -185 AssertUtil.notBlank(login, "The RunDeck login is mandatory !"); -186 AssertUtil.notBlank(password, "The RunDeck password is mandatory !"); -187 this.login = login; -188 this.password = password; -189 this.token = null; -190 } -191 -192 /** -193 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url, -194 * using token-based or session-based authentication. Either token or sessionID must be valid -195 * -196 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) -197 * @param token to use for authentication on the RunDeck instance -198 * @param sessionID to use for session authentication on the RunDeck instance -199 * @param useToken should be true if using token, false if using sessionID -200 * @throws IllegalArgumentException if the url or token is blank (null, empty or whitespace) -201 * @deprecated Use the builder {@link RundeckClientBuilder}, this method will not be public in version 10 of this library. -202 */ -203 public RundeckClient(String url, String token, String sessionID, boolean useToken) throws IllegalArgumentException { -204 this(url); -205 -206 if(useToken){ -207 AssertUtil.notBlank(token, "Token is mandatory!"); -208 this.token = token; -209 this.sessionID = null; -210 } -211 else { -212 AssertUtil.notBlank(sessionID, "sessionID is mandatory!"); -213 this.sessionID = sessionID; -214 this.token = null; -215 } -216 this.login = null; -217 this.password = null; -218 } -219 +103 V9(9), +104 ; +105 +106 private int versionNumber; +107 +108 Version(final int i) { +109 versionNumber = i; +110 } +111 +112 public int getVersionNumber() { +113 return versionNumber; +114 } +115 } +116 /** Version of the API supported */ +117 public static final transient int API_VERSION = Version.V9.getVersionNumber(); +118 +119 private static final String API = "/api/"; +120 +121 /** End-point of the API */ +122 public static final transient String API_ENDPOINT = API + API_VERSION; +123 +124 /** Default value for the "pooling interval" used when running jobs/commands/scripts */ +125 private static final transient long DEFAULT_POOLING_INTERVAL = 5; +126 +127 /** Default unit of the "pooling interval" used when running jobs/commands/scripts */ +128 private static final transient TimeUnit DEFAULT_POOLING_UNIT = TimeUnit.SECONDS; +129 +130 /** URL of the RunDeck instance ("http://localhost:4440" target="alexandria_uri">http://localhost:4440", "http://rundeck.your-compagny.com/", etc) */ +131 private final String url; +132 +133 private int apiVersion = API_VERSION; +134 +135 private String token; +136 +137 private String login; +138 +139 private String password; +140 +141 private String sessionID; +142 +143 void setToken(String token) { +144 this.token = token; +145 } +146 +147 void setLogin(String login) { +148 this.login = login; +149 } +150 +151 void setPassword(String password) { +152 this.password = password; +153 } +154 +155 void setSessionID(String sessionID) { +156 this.sessionID = sessionID; +157 } +158 +159 int getApiVersion() { +160 return apiVersion; +161 } +162 +163 void setApiVersion(int apiVersion) { +164 this.apiVersion = apiVersion; +165 } +166 +167 void setApiVersion(Version apiVersion) { +168 this.apiVersion = apiVersion.getVersionNumber(); +169 } +170 +171 String getApiEndpoint() { +172 return API + getApiVersion(); +173 } +174 +175 /** +176 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url, using login-based +177 * authentication. +178 * +179 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) +180 * @param login to use for authentication on the RunDeck instance +181 * @param password to use for authentication on the RunDeck instance +182 * @throws IllegalArgumentException if the url, login or password is blank (null, empty or whitespace) +183 */ +184 public RundeckClient(String url, String login, String password) throws IllegalArgumentException { +185 this(url); +186 AssertUtil.notBlank(login, "The RunDeck login is mandatory !"); +187 AssertUtil.notBlank(password, "The RunDeck password is mandatory !"); +188 this.login = login; +189 this.password = password; +190 this.token = null; +191 } +192 +193 /** +194 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url, +195 * using token-based or session-based authentication. Either token or sessionID must be valid +196 * +197 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) +198 * @param token to use for authentication on the RunDeck instance +199 * @param sessionID to use for session authentication on the RunDeck instance +200 * @param useToken should be true if using token, false if using sessionID +201 * @throws IllegalArgumentException if the url or token is blank (null, empty or whitespace) +202 * @deprecated Use the builder {@link RundeckClientBuilder}, this method will not be public in version 10 of this library. +203 */ +204 public RundeckClient(String url, String token, String sessionID, boolean useToken) throws IllegalArgumentException { +205 this(url); +206 +207 if(useToken){ +208 AssertUtil.notBlank(token, "Token is mandatory!"); +209 this.token = token; +210 this.sessionID = null; +211 } +212 else { +213 AssertUtil.notBlank(sessionID, "sessionID is mandatory!"); +214 this.sessionID = sessionID; +215 this.token = null; +216 } +217 this.login = null; +218 this.password = null; +219 } 220 -221 public RundeckClient(String url, String token) throws IllegalArgumentException { -222 this(url, token, null, true); -223 } -224 -225 /** -226 * Used by RundeckClientBuilder -227 */ -228 RundeckClient(final String url) throws IllegalArgumentException { -229 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !"); -230 this.url=url; -231 } -232 -233 /** -234 * Create a builder for RundeckClient -235 */ -236 public static RundeckClientBuilder builder() { -237 return new RundeckClientBuilder(); -238 } -239 -240 /** -241 * Try to "ping" the RunDeck instance to see if it is alive -242 * -243 * @throws RundeckApiException if the ping fails -244 */ -245 public void ping() throws RundeckApiException { -246 new ApiCall(this).ping(); -247 } -248 -249 /** -250 * Test the authentication on the RunDeck instance. -251 * -252 * @return sessionID if doing username+password login and it succeeded -253 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -254 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -255 */ -256 public String testAuth() throws RundeckApiLoginException, RundeckApiTokenException { -257 return (new ApiCall(this)).testAuth(); -258 } -259 -260 /** -261 * @deprecated Use {@link #testAuth()} -262 * @see #testAuth() -263 */ -264 @Deprecated -265 public void testCredentials() throws RundeckApiLoginException, RundeckApiTokenException { -266 testAuth(); -267 } -268 -269 /* -270 * Projects -271 */ -272 -273 /** -274 * List all projects -275 * -276 * @return a {@link List} of {@link RundeckProject} : might be empty, but won't be null -277 * @throws RundeckApiException in case of error when calling the API -278 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -279 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -280 */ -281 public List<RundeckProject> getProjects() throws RundeckApiException, RundeckApiLoginException, -282 RundeckApiTokenException { -283 return new ApiCall(this).get(new ApiPathBuilder("/projects"), -284 new ListParser<RundeckProject>(new ProjectParser(), "result/projects/project")); -285 } -286 -287 /** -288 * Get the definition of a single project, identified by the given name -289 * -290 * @param projectName name of the project - mandatory -291 * @return a {@link RundeckProject} instance - won't be null -292 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -293 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -294 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -295 * @throws IllegalArgumentException if the projectName is blank (null, empty or whitespace) -296 */ -297 public RundeckProject getProject(String projectName) throws RundeckApiException, RundeckApiLoginException, -298 RundeckApiTokenException, IllegalArgumentException { -299 AssertUtil.notBlank(projectName, "projectName is mandatory to get the details of a project !"); -300 return new ApiCall(this).get(new ApiPathBuilder("/project/", projectName), -301 new ProjectParser("result/projects/project")); -302 } -303 -304 /* -305 * Jobs -306 */ -307 -308 /** -309 * List all jobs (for all projects) -310 * -311 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null -312 * @throws RundeckApiException in case of error when calling the API -313 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -314 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -315 */ -316 public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException { -317 List<RundeckJob> jobs = new ArrayList<RundeckJob>(); -318 for (RundeckProject project : getProjects()) { -319 jobs.addAll(getJobs(project.getName())); -320 } -321 return jobs; -322 } -323 -324 /** -325 * List all jobs that belongs to the given project -326 * -327 * @param project name of the project - mandatory -328 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null -329 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -330 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -331 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -332 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -333 * @see #getJobs(String, String, String, String...) -334 */ -335 public List<RundeckJob> getJobs(String project) throws RundeckApiException, RundeckApiLoginException, -336 RundeckApiTokenException, IllegalArgumentException { -337 return getJobs(project, null, null, new String[0]); -338 } -339 -340 /** -341 * List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds) -342 * -343 * @param project name of the project - mandatory -344 * @param jobFilter a filter for the job Name - optional -345 * @param groupPath a group or partial group path to include all jobs within that group path - optional -346 * @param jobIds a list of Job IDs to include - optional -347 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null -348 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -349 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -350 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -351 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -352 * @see #getJobs(String) -353 */ -354 public List<RundeckJob> getJobs(String project, String jobFilter, String groupPath, String... jobIds) -355 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -356 AssertUtil.notBlank(project, "project is mandatory to get all jobs !"); -357 return new ApiCall(this).get(new ApiPathBuilder("/jobs").param("project", project) -358 .param("jobFilter", jobFilter) -359 .param("groupPath", groupPath) -360 .param("idlist", StringUtils.join(jobIds, ",")), -361 new ListParser<RundeckJob>(new JobParser(), "result/jobs/job")); -362 } -363 -364 /** -365 * Export the definitions of all jobs that belongs to the given project -366 * -367 * @param filename path of the file where the content should be saved - mandatory -368 * @param format of the export. See {@link FileType} - mandatory -369 * @param project name of the project - mandatory -370 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -371 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -372 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -373 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is -374 * invalid -375 * @throws IOException if we failed to write to the file -376 * @see #exportJobsToFile(String, FileType, String, String, String, String...) -377 * @see #exportJobs(String, String) -378 */ -379 public void exportJobsToFile(String filename, String format, String project) throws RundeckApiException, -380 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -381 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); -382 exportJobsToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), project); -383 } -384 -385 /** -386 * Export the definitions of all jobs that belongs to the given project -387 * -388 * @param filename path of the file where the content should be saved - mandatory -389 * @param format of the export. See {@link FileType} - mandatory -390 * @param project name of the project - mandatory -391 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -392 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -393 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -394 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null -395 * @throws IOException if we failed to write to the file -396 * @see #exportJobsToFile(String, FileType, String, String, String, String...) -397 * @see #exportJobs(FileType, String) -398 */ -399 public void exportJobsToFile(String filename, FileType format, String project) throws RundeckApiException, -400 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -401 exportJobsToFile(filename, format, project, null, null, new String[0]); -402 } -403 -404 /** -405 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, -406 * groupPath and jobIds) -407 * -408 * @param filename path of the file where the content should be saved - mandatory -409 * @param format of the export. See {@link FileType} - mandatory -410 * @param project name of the project - mandatory -411 * @param jobFilter a filter for the job Name - optional -412 * @param groupPath a group or partial group path to include all jobs within that group path - optional -413 * @param jobIds a list of Job IDs to include - optional -414 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -415 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -416 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -417 * @throws IllegalArgumentException if the filename, format or project is blank (null, empty or whitespace), or the -418 * format is invalid -419 * @throws IOException if we failed to write to the file -420 * @see #exportJobsToFile(String, FileType, String, String, String, String...) -421 * @see #exportJobs(FileType, String, String, String, String...) -422 */ -423 public void exportJobsToFile(String filename, String format, String project, String jobFilter, String groupPath, -424 String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -425 IllegalArgumentException, IOException { -426 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); -427 exportJobsToFile(filename, -428 FileType.valueOf(StringUtils.upperCase(format)), -429 project, -430 jobFilter, -431 groupPath, -432 jobIds); -433 } -434 -435 /** -436 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, -437 * groupPath and jobIds) -438 * -439 * @param filename path of the file where the content should be saved - mandatory -440 * @param format of the export. See {@link FileType} - mandatory -441 * @param project name of the project - mandatory -442 * @param jobFilter a filter for the job Name - optional -443 * @param groupPath a group or partial group path to include all jobs within that group path - optional -444 * @param jobIds a list of Job IDs to include - optional -445 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -446 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -447 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -448 * @throws IllegalArgumentException if the filename or project is blank (null, empty or whitespace), or the format -449 * is null -450 * @throws IOException if we failed to write to the file -451 * @see #exportJobs(FileType, String, String, String, String...) -452 */ -453 public void exportJobsToFile(String filename, FileType format, String project, String jobFilter, String groupPath, -454 String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -455 IllegalArgumentException, IOException { -456 AssertUtil.notBlank(filename, "filename is mandatory to export a job !"); -457 InputStream inputStream = exportJobs(format, project, jobFilter, groupPath, jobIds); -458 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream)); -459 } -460 -461 /** -462 * Export the definitions of all jobs that belongs to the given project -463 * -464 * @param format of the export. See {@link FileType} - mandatory -465 * @param project name of the project - mandatory -466 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -467 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -468 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -469 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -470 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is -471 * invalid -472 * @see #exportJobs(FileType, String, String, String, String...) -473 * @see #exportJobsToFile(String, String, String) -474 */ -475 public InputStream exportJobs(String format, String project) throws RundeckApiException, RundeckApiLoginException, -476 RundeckApiTokenException, IllegalArgumentException { -477 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); -478 return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project); -479 } -480 -481 /** -482 * Export the definitions of all jobs that belongs to the given project -483 * -484 * @param format of the export. See {@link FileType} - mandatory -485 * @param project name of the project - mandatory -486 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -487 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -488 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -489 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -490 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null -491 * @see #exportJobs(FileType, String, String, String, String...) -492 * @see #exportJobsToFile(String, FileType, String) -493 */ -494 public InputStream exportJobs(FileType format, String project) throws RundeckApiException, -495 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -496 return exportJobs(format, project, null, null, new String[0]); -497 } -498 -499 /** -500 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, -501 * groupPath and jobIds) -502 * -503 * @param format of the export. See {@link FileType} - mandatory -504 * @param project name of the project - mandatory -505 * @param jobFilter a filter for the job Name - optional -506 * @param groupPath a group or partial group path to include all jobs within that group path - optional -507 * @param jobIds a list of Job IDs to include - optional -508 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -509 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -510 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -511 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -512 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is -513 * invalid -514 * @see #exportJobs(FileType, String, String, String, String...) -515 * @see #exportJobsToFile(String, String, String, String, String, String...) -516 */ -517 public InputStream exportJobs(String format, String project, String jobFilter, String groupPath, String... jobIds) -518 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -519 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); -520 return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project, jobFilter, groupPath, jobIds); -521 } -522 -523 /** -524 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, -525 * groupPath and jobIds) -526 * -527 * @param format of the export. See {@link FileType} - mandatory -528 * @param project name of the project - mandatory -529 * @param jobFilter a filter for the job Name - optional -530 * @param groupPath a group or partial group path to include all jobs within that group path - optional -531 * @param jobIds a list of Job IDs to include - optional -532 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -533 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -534 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -535 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -536 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null -537 * @see #exportJobsToFile(String, FileType, String, String, String, String...) -538 */ -539 public InputStream exportJobs(FileType format, String project, String jobFilter, String groupPath, String... jobIds) -540 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -541 AssertUtil.notNull(format, "format is mandatory to export jobs !"); -542 AssertUtil.notBlank(project, "project is mandatory to export jobs !"); -543 return new ApiCall(this).get(new ApiPathBuilder("/jobs/export").param("format", format) -544 .param("project", project) -545 .param("jobFilter", jobFilter) -546 .param("groupPath", groupPath) -547 .param("idlist", StringUtils.join(jobIds, ","))); -548 } -549 -550 /** -551 * Export the definition of a single job (identified by the given ID) -552 * -553 * @param filename path of the file where the content should be saved - mandatory -554 * @param format of the export. See {@link FileType} - mandatory -555 * @param jobId identifier of the job - mandatory -556 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -557 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -558 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -559 * @throws IllegalArgumentException if the filename, format or jobId is blank (null, empty or whitespace), or the -560 * format is invalid -561 * @throws IOException if we failed to write to the file -562 * @see #exportJobToFile(String, FileType, String) -563 * @see #exportJob(String, String) -564 * @see #getJob(String) -565 */ -566 public void exportJobToFile(String filename, String format, String jobId) throws RundeckApiException, -567 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -568 AssertUtil.notBlank(format, "format is mandatory to export a job !"); -569 exportJobToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), jobId); -570 } -571 -572 /** -573 * Export the definition of a single job (identified by the given ID) -574 * -575 * @param filename path of the file where the content should be saved - mandatory -576 * @param format of the export. See {@link FileType} - mandatory -577 * @param jobId identifier of the job - mandatory -578 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -579 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -580 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -581 * @throws IllegalArgumentException if the filename or jobId is blank (null, empty or whitespace), or the format is -582 * null -583 * @throws IOException if we failed to write to the file -584 * @see #exportJob(FileType, String) -585 * @see #getJob(String) -586 */ -587 public void exportJobToFile(String filename, FileType format, String jobId) throws RundeckApiException, -588 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -589 AssertUtil.notBlank(filename, "filename is mandatory to export a job !"); -590 InputStream inputStream = exportJob(format, jobId); -591 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream)); -592 } -593 -594 /** -595 * Export the definition of a single job, identified by the given ID -596 * -597 * @param format of the export. See {@link FileType} - mandatory -598 * @param jobId identifier of the job - mandatory -599 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -600 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -601 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -602 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -603 * @throws IllegalArgumentException if the format or jobId is blank (null, empty or whitespace), or the format is -604 * invalid -605 * @see #exportJobToFile(String, String, String) -606 * @see #getJob(String) -607 */ -608 public InputStream exportJob(String format, String jobId) throws RundeckApiException, RundeckApiLoginException, -609 RundeckApiTokenException, IllegalArgumentException { -610 AssertUtil.notBlank(format, "format is mandatory to export a job !"); -611 return exportJob(FileType.valueOf(StringUtils.upperCase(format)), jobId); -612 } -613 -614 /** -615 * Export the definition of a single job, identified by the given ID -616 * -617 * @param format of the export. See {@link FileType} - mandatory -618 * @param jobId identifier of the job - mandatory -619 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -620 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -621 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -622 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -623 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the format is null -624 * @see #exportJobToFile(String, FileType, String) -625 * @see #getJob(String) -626 */ -627 public InputStream exportJob(FileType format, String jobId) throws RundeckApiException, RundeckApiLoginException, -628 RundeckApiTokenException, IllegalArgumentException { -629 AssertUtil.notNull(format, "format is mandatory to export a job !"); -630 AssertUtil.notBlank(jobId, "jobId is mandatory to export a job !"); -631 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId).param("format", format)); -632 } -633 -634 /** -635 * Import the definitions of jobs, from the given file -636 * -637 * @param filename of the file containing the jobs definitions - mandatory -638 * @param fileType type of the file. See {@link FileType} - mandatory -639 * @return a {@link RundeckJobsImportResult} instance - won't be null -640 * @throws RundeckApiException in case of error when calling the API -641 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -642 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -643 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the -644 * fileType is invalid -645 * @throws IOException if we failed to read the file -646 * @see #importJobs(InputStream, String) -647 * @see #importJobs(String, FileType, RundeckJobsImportMethod) -648 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this library. -649 */ -650 public RundeckJobsImportResult importJobs(String filename, String fileType) throws RundeckApiException, -651 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -652 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); -653 return importJobs(filename, FileType.valueOf(StringUtils.upperCase(fileType))); -654 } -655 -656 /** -657 * Import the definitions of jobs, from the given file -658 * -659 * @param filename of the file containing the jobs definitions - mandatory -660 * @param fileType type of the file. See {@link FileType} - mandatory -661 * @return a {@link RundeckJobsImportResult} instance - won't be null -662 * @throws RundeckApiException in case of error when calling the API -663 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -664 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -665 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null -666 * @throws IOException if we failed to read the file -667 * @see #importJobs(InputStream, FileType) -668 * @see #importJobs(String, FileType, RundeckJobsImportMethod) -669 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this -670 * library. -671 */ -672 public RundeckJobsImportResult importJobs(String filename, FileType fileType) throws RundeckApiException, -673 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -674 return importJobs(filename, fileType, (RundeckJobsImportMethod) null); -675 } -676 -677 /** -678 * Import the definitions of jobs, from the given file, using the given behavior -679 * -680 * @param filename of the file containing the jobs definitions - mandatory -681 * @param fileType type of the file. See {@link FileType} - mandatory -682 * @param importBehavior see {@link RundeckJobsImportMethod} -683 * @return a {@link RundeckJobsImportResult} instance - won't be null -684 * @throws RundeckApiException in case of error when calling the API -685 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -686 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -687 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the -688 * fileType or behavior is not valid -689 * @throws IOException if we failed to read the file -690 * @see #importJobs(InputStream, String, String) -691 * @see #importJobs(String, FileType, RundeckJobsImportMethod) -692 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this -693 * library. -694 */ -695 public RundeckJobsImportResult importJobs(String filename, String fileType, String importBehavior) -696 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, -697 IOException { -698 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); -699 return importJobs(filename, -700 FileType.valueOf(StringUtils.upperCase(fileType)), -701 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior))); -702 } -703 -704 /** -705 * Import the definitions of jobs, from the given file, using the given behavior -706 * -707 * @param filename of the file containing the jobs definitions - mandatory -708 * @param fileType type of the file. See {@link FileType} - mandatory -709 * @param importBehavior see {@link RundeckJobsImportMethod} -710 * @return a {@link RundeckJobsImportResult} instance - won't be null -711 * @throws RundeckApiException in case of error when calling the API -712 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -713 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -714 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null -715 * @throws IOException if we failed to read the file -716 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) -717 * @deprecated use {@link #importJobs(String, RundeckJobsImport)}, this method will be removed in version 10 of -718 * this library. -719 */ -720 public RundeckJobsImportResult importJobs(String filename, FileType fileType, RundeckJobsImportMethod importBehavior) -721 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, -722 IOException { -723 AssertUtil.notBlank(filename, "filename (of jobs file) is mandatory to import jobs !"); -724 FileInputStream stream = null; -725 try { -726 stream = FileUtils.openInputStream(new File(filename)); -727 return importJobs(stream, fileType, importBehavior); -728 } finally { -729 IOUtils.closeQuietly(stream); -730 } -731 } -732 -733 /** -734 * Import the definitions of jobs, from the given input stream -735 * -736 * @param stream inputStream for reading the definitions - mandatory -737 * @param fileType type of the file. See {@link FileType} - mandatory -738 * @return a {@link RundeckJobsImportResult} instance - won't be null -739 * @throws RundeckApiException in case of error when calling the API -740 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -741 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -742 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace) or -743 * invalid -744 * @see #importJobs(String, String) -745 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) -746 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this -747 * library. -748 */ -749 public RundeckJobsImportResult importJobs(InputStream stream, String fileType) throws RundeckApiException, -750 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -751 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); -752 return importJobs(stream, FileType.valueOf(StringUtils.upperCase(fileType))); -753 } -754 -755 /** -756 * Import the definitions of jobs, from the given input stream -757 * -758 * @param stream inputStream for reading the definitions - mandatory -759 * @param fileType type of the file. See {@link FileType} - mandatory -760 * @return a {@link RundeckJobsImportResult} instance - won't be null -761 * @throws RundeckApiException in case of error when calling the API -762 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -763 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -764 * @throws IllegalArgumentException if the stream or fileType is null -765 * @see #importJobs(String, FileType) -766 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) -767 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this -768 * library. -769 */ -770 public RundeckJobsImportResult importJobs(InputStream stream, FileType fileType) throws RundeckApiException, -771 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -772 return importJobs(stream, fileType, (RundeckJobsImportMethod) null); -773 } -774 -775 /** -776 * Import the definitions of jobs, from the given input stream, using the given behavior -777 * -778 * @param stream inputStream for reading the definitions - mandatory -779 * @param fileType type of the file. See {@link FileType} - mandatory -780 * @param importBehavior see {@link RundeckJobsImportMethod} -781 * @return a {@link RundeckJobsImportResult} instance - won't be null -782 * @throws RundeckApiException in case of error when calling the API -783 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -784 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -785 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace), or -786 * the fileType or behavior is not valid -787 * @see #importJobs(String, String, String) -788 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) -789 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this -790 * library. -791 */ -792 public RundeckJobsImportResult importJobs(InputStream stream, String fileType, String importBehavior) -793 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -794 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); -795 return importJobs(stream, -796 FileType.valueOf(StringUtils.upperCase(fileType)), -797 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior))); -798 } -799 -800 /** -801 * Import the definitions of jobs, from the given input stream, using the given behavior -802 * -803 * @param stream inputStream for reading the definitions - mandatory -804 * @param fileType type of the file. See {@link FileType} - mandatory -805 * @param importBehavior see {@link RundeckJobsImportMethod} -806 * @return a {@link RundeckJobsImportResult} instance - won't be null -807 * @throws RundeckApiException in case of error when calling the API -808 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -809 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -810 * @throws IllegalArgumentException if the stream or fileType is null -811 * @see #importJobs(String, FileType, RundeckJobsImportMethod) -812 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this -813 * library. -814 */ -815 public RundeckJobsImportResult importJobs(InputStream stream, FileType fileType, -816 RundeckJobsImportMethod importBehavior) throws RundeckApiException, RundeckApiLoginException, -817 RundeckApiTokenException, IllegalArgumentException { -818 return importJobs(RundeckJobsImportBuilder.builder().setStream(stream).setFileType(fileType) -819 .setJobsImportMethod(importBehavior).build()); -820 } -821 -822 /** -823 * Import the definitions of jobs, from the given input stream, using the given behavior -824 * -825 * @param rundeckJobsImport import request, see {@link RundeckJobsImportBuilder} -826 * -827 * @return a {@link RundeckJobsImportResult} instance - won't be null -828 * -829 * @throws RundeckApiException in case of error when calling the API -830 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -831 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -832 * @throws IllegalArgumentException if the stream or fileType is null -833 * @see #importJobs(String, FileType, RundeckJobsImportMethod) -834 */ -835 public RundeckJobsImportResult importJobs(final String filename,final RundeckJobsImport rundeckJobsImport) throws RundeckApiException, -836 RundeckApiLoginException, -837 RundeckApiTokenException, IllegalArgumentException, IOException { -838 AssertUtil.notBlank(filename, "filename (of jobs file) is mandatory to import jobs !"); -839 FileInputStream stream = null; -840 try { -841 stream = FileUtils.openInputStream(new File(filename)); -842 return importJobs(RundeckJobsImportBuilder.builder(rundeckJobsImport).setStream(stream).build()); -843 } finally { -844 -845 IOUtils.closeQuietly(stream); -846 } -847 } -848 /** -849 * Import the definitions of jobs, from the given input stream, using the given behavior -850 * -851 * @param rundeckJobsImport import request, see {@link RundeckJobsImportBuilder} -852 * -853 * @return a {@link RundeckJobsImportResult} instance - won't be null -854 * -855 * @throws RundeckApiException in case of error when calling the API -856 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -857 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -858 * @throws IllegalArgumentException if the stream or fileType is null -859 * @see #importJobs(String, FileType, RundeckJobsImportMethod) -860 */ -861 public RundeckJobsImportResult importJobs(final RundeckJobsImport rundeckJobsImport) throws RundeckApiException, -862 RundeckApiLoginException, -863 RundeckApiTokenException, IllegalArgumentException { -864 -865 AssertUtil.notNull(rundeckJobsImport.getStream(), "inputStream of jobs is mandatory to import jobs !"); -866 AssertUtil.notNull(rundeckJobsImport.getFileType(), "fileType is mandatory to import jobs !"); -867 final ApiPathBuilder request = new ApiPathBuilder(JOBS_IMPORT) -868 .param("format", rundeckJobsImport.getFileType()) -869 .param("dupeOption", rundeckJobsImport.getImportMethod()) -870 .attach("xmlBatch", rundeckJobsImport.getStream()); -871 if(null!=rundeckJobsImport.getProject()) { -872 //API v8 -873 request.param("project", rundeckJobsImport.getProject()); -874 } -875 return new ApiCall(this).post(request, new JobsImportResultParser("result")); -876 } -877 -878 /** -879 * Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not -880 * need to belong to a group (either pass null, or an empty string). -881 * -882 * @param project name of the project - mandatory -883 * @param groupPath group to which the job belongs (if it belongs to a group) - optional -884 * @param name of the job to find - mandatory -885 * @return a {@link RundeckJob} instance - null if not found -886 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -887 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -888 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -889 * @throws IllegalArgumentException if the project or the name is blank (null, empty or whitespace) -890 * @see #getJob(String) -891 */ -892 public RundeckJob findJob(String project, String groupPath, String name) throws RundeckApiException, -893 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -894 AssertUtil.notBlank(project, "project is mandatory to find a job !"); -895 AssertUtil.notBlank(name, "job name is mandatory to find a job !"); -896 List<RundeckJob> jobs = getJobs(project, name, groupPath, new String[0]); -897 return jobs.isEmpty() ? null : jobs.get(0); -898 } -899 -900 /** -901 * Get the definition of a single job, identified by the given ID -902 * -903 * @param jobId identifier of the job - mandatory -904 * @return a {@link RundeckJob} instance - won't be null -905 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -906 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -907 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -908 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -909 * @see #findJob(String, String, String) -910 * @see #exportJob(String, String) -911 */ -912 public RundeckJob getJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -913 RundeckApiTokenException, IllegalArgumentException { -914 AssertUtil.notBlank(jobId, "jobId is mandatory to get the details of a job !"); -915 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId), new JobParser("joblist/job")); -916 } -917 -918 /** -919 * Delete a single job, identified by the given ID -920 * -921 * @param jobId identifier of the job - mandatory -922 * @return the success message (note that in case of error, you'll get an exception) -923 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -924 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -925 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -926 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -927 */ -928 public String deleteJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -929 RundeckApiTokenException, IllegalArgumentException { -930 AssertUtil.notBlank(jobId, "jobId is mandatory to delete a job !"); -931 return new ApiCall(this).delete(new ApiPathBuilder("/job/", jobId), new StringParser("result/success/message")); -932 } -933 /** -934 * Delete multiple jobs, identified by the given IDs -935 * -936 * @param jobIds List of job IDS -937 * @return the bulk delete result -938 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -939 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -940 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -941 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -942 */ -943 public RundeckJobDeleteBulk deleteJobs(final List<String> jobIds) throws RundeckApiException, RundeckApiLoginException, -944 RundeckApiTokenException, IllegalArgumentException { -945 if (null == jobIds || 0 == jobIds.size()) { -946 throw new IllegalArgumentException("jobIds are mandatory to delete a job"); -947 } -948 return new ApiCall(this).post(new ApiPathBuilder("/jobs/delete").field("ids",jobIds), -949 new BulkDeleteParser("result/deleteJobs")); -950 } -951 -952 /** -953 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -954 * end of the job execution) -955 * -956 * @param jobId identifier of the job - mandatory -957 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -958 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -959 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -960 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -961 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -962 * @see #triggerJob(String, Properties, Properties) -963 * @see #runJob(String) -964 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library -965 */ -966 public RundeckExecution triggerJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -967 RundeckApiTokenException, IllegalArgumentException { -968 return triggerJob(jobId, null); -969 } -970 -971 /** -972 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -973 * end of the job execution) -974 * -975 * @param jobId identifier of the job - mandatory -976 * @param options of the job - optional. See {@link OptionsBuilder}. -977 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -978 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -979 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -980 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -981 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -982 * @see #triggerJob(String, Properties, Properties) -983 * @see #runJob(String, Properties) -984 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library -985 */ -986 public RundeckExecution triggerJob(String jobId, Properties options) throws RundeckApiException, -987 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -988 return triggerJob(jobId, options, null); -989 } -990 -991 /** -992 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -993 * end of the job execution) -994 * -995 * @param jobId identifier of the job - mandatory -996 * @param options of the job - optional. See {@link OptionsBuilder}. -997 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -998 * {@link NodeFiltersBuilder} -999 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1000 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1001 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1002 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1003 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1004 * @see #triggerJob(String) -1005 * @see #runJob(String, Properties, Properties) -1006 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library -1007 */ -1008 public RundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters) -1009 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1010 return triggerJob(jobId, options, nodeFilters, null); -1011 } -1012 /** -1013 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -1014 * end of the job execution) -1015 * -1016 * @param jobId identifier of the job - mandatory -1017 * @param options of the job - optional. See {@link OptionsBuilder}. -1018 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -1019 * {@link NodeFiltersBuilder} -1020 * @param asUser specify a user name to run the job as, must have 'runAs' permission -1021 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1022 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1023 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1024 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1025 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1026 * @see #triggerJob(String) -1027 * @see #runJob(String, Properties, Properties) -1028 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library -1029 */ -1030 public RundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters, String asUser) -1031 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1032 return triggerJob(RunJobBuilder.builder() -1033 .setJobId(jobId) -1034 .setOptions(options) -1035 .setNodeFilters(nodeFilters) -1036 .setAsUser(asUser) -1037 .build()); -1038 } -1039 /** -1040 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -1041 * end of the job execution) -1042 * -1043 * @param jobRun the RunJob, see {@link RunJobBuilder} -1044 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1045 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1046 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1047 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1048 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1049 * @see #triggerJob(String) -1050 * @see #runJob(String, Properties, Properties) -1051 */ -1052 public RundeckExecution triggerJob(final RunJob jobRun) -1053 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1054 AssertUtil.notBlank(jobRun.getJobId(), "jobId is mandatory to trigger a job !"); -1055 ApiPathBuilder apiPath = new ApiPathBuilder("/job/", jobRun.getJobId(), "/run").param("argString", -1056 ParametersUtil.generateArgString(jobRun.getOptions())) -1057 .nodeFilters(jobRun.getNodeFilters()); -1058 if(null!=jobRun.getAsUser()) { -1059 apiPath.param("asUser", jobRun.getAsUser()); -1060 } -1061 return new ApiCall(this).get(apiPath, new ExecutionParser("result/executions/execution")); -1062 } -1063 -1064 /** -1065 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1066 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -1067 * aborted) or is still running. -1068 * -1069 * @param jobId identifier of the job - mandatory -1070 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1071 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1072 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1073 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1074 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1075 * @see #triggerJob(String) -1076 * @see #runJob(String, Properties, Properties, long, TimeUnit) -1077 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, -1078 * this method will be removed in version 10 of this library -1079 */ -1080 public RundeckExecution runJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -1081 RundeckApiTokenException, IllegalArgumentException { -1082 return runJob(jobId, null); -1083 } -1084 -1085 /** -1086 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1087 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -1088 * aborted) or is still running. -1089 * -1090 * @param jobId identifier of the job - mandatory -1091 * @param options of the job - optional. See {@link OptionsBuilder}. -1092 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1093 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1094 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1095 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1096 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1097 * @see #triggerJob(String, Properties) -1098 * @see #runJob(String, Properties, Properties, long, TimeUnit) -1099 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, -1100 * this method will be removed in version 10 of this library -1101 */ -1102 public RundeckExecution runJob(String jobId, Properties options) throws RundeckApiException, -1103 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1104 return runJob(jobId, options, null); -1105 } -1106 -1107 /** -1108 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1109 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -1110 * aborted) or is still running. -1111 * -1112 * @param jobId identifier of the job - mandatory -1113 * @param options of the job - optional. See {@link OptionsBuilder}. -1114 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -1115 * {@link NodeFiltersBuilder} -1116 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1117 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1118 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1119 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1120 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1121 * @see #triggerJob(String, Properties, Properties) -1122 * @see #runJob(String, Properties, Properties, long, TimeUnit) -1123 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, -1124 * this method will be removed in version 10 of this library -1125 */ -1126 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters) -1127 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1128 return runJob(jobId, options, nodeFilters, DEFAULT_POOLING_INTERVAL, DEFAULT_POOLING_UNIT); -1129 } -1130 -1131 /** -1132 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1133 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -1134 * aborted) or is still running. -1135 * -1136 * @param runJob the RunJob, see {@link RunJobBuilder} -1137 * -1138 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1139 * -1140 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1141 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1142 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1143 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1144 * @see #triggerJob(RunJob) -1145 * @see #runJob(RunJob, long, TimeUnit) -1146 */ -1147 public RundeckExecution runJob(final RunJob runJob) throws RundeckApiException, RundeckApiLoginException, -1148 RundeckApiTokenException, IllegalArgumentException { -1149 return runJob(runJob, DEFAULT_POOLING_INTERVAL, DEFAULT_POOLING_UNIT); -1150 } -1151 /** -1152 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1153 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to -1154 * know if the execution is finished (or aborted) or is still running. -1155 * -1156 * @param jobId identifier of the job - mandatory -1157 * @param options of the job - optional. See {@link OptionsBuilder}. -1158 * @param poolingInterval for checking the status of the execution. Must be > 0. -1159 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1160 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1161 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1162 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1163 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1164 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1165 * @see #triggerJob(String, Properties) -1166 * @see #runJob(String, Properties, Properties, long, TimeUnit) -1167 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, -1168 * this method will be removed in version 10 of this library -1169 */ -1170 public RundeckExecution runJob(String jobId, Properties options, long poolingInterval, TimeUnit poolingUnit) -1171 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1172 return runJob(jobId, options, null, poolingInterval, poolingUnit); -1173 } -1174 -1175 /** -1176 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1177 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to -1178 * know if the execution is finished (or aborted) or is still running. -1179 * -1180 * @param jobId identifier of the job - mandatory -1181 * @param options of the job - optional. See {@link OptionsBuilder}. -1182 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -1183 * {@link NodeFiltersBuilder} -1184 * @param poolingInterval for checking the status of the execution. Must be > 0. -1185 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1186 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1187 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1188 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1189 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1190 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1191 * @see #triggerJob(String, Properties) -1192 * @see #runJob(String, Properties, Properties, long, TimeUnit) -1193 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, -1194 * this method will be removed in version 10 of this library -1195 */ -1196 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, long poolingInterval, -1197 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -1198 IllegalArgumentException { -1199 return runJob(jobId, options, nodeFilters, null, poolingInterval, poolingUnit); -1200 } -1201 /** -1202 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1203 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to -1204 * know if the execution is finished (or aborted) or is still running. -1205 * -1206 * @param jobId identifier of the job - mandatory -1207 * @param options of the job - optional. See {@link OptionsBuilder}. -1208 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -1209 * {@link NodeFiltersBuilder} -1210 * @param asUser specify a user name to run the job as, must have 'runAs' permission -1211 * @param poolingInterval for checking the status of the execution. Must be > 0. -1212 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1213 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1214 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1215 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1216 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1217 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1218 * @see #triggerJob(String, Properties) -1219 * @see #runJob(String, Properties, Properties, long, TimeUnit) -1220 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, this method will be removed in version 10 of this library -1221 */ -1222 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, String asUser, long poolingInterval, -1223 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -1224 IllegalArgumentException { -1225 return runJob(RunJobBuilder.builder() -1226 .setJobId(jobId) -1227 .setOptions(options) -1228 .setNodeFilters(nodeFilters) -1229 .setAsUser(asUser) -1230 .build(), poolingInterval, poolingUnit); -1231 } -1232 -1233 /** -1234 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -1235 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to -1236 * know if the execution is finished (or aborted) or is still running. -1237 * -1238 * @param jobRun the RunJob, see {@link RunJobBuilder} -1239 * @param poolingInterval for checking the status of the execution. Must be > 0. -1240 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1241 * -1242 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1243 * -1244 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -1245 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1246 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1247 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -1248 * @see #triggerJob(RunJob) -1249 */ -1250 public RundeckExecution runJob(final RunJob jobRun, long poolingInterval, -1251 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -1252 IllegalArgumentException { -1253 -1254 if (poolingInterval <= 0) { -1255 poolingInterval = DEFAULT_POOLING_INTERVAL; -1256 poolingUnit = DEFAULT_POOLING_UNIT; -1257 } -1258 if (poolingUnit == null) { -1259 poolingUnit = DEFAULT_POOLING_UNIT; -1260 } -1261 -1262 RundeckExecution execution = triggerJob(jobRun); -1263 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { -1264 try { -1265 Thread.sleep(poolingUnit.toMillis(poolingInterval)); -1266 } catch (InterruptedException e) { -1267 break; -1268 } -1269 execution = getExecution(execution.getId()); -1270 } -1271 return execution; -1272 } -1273 -1274 /* -1275 * Ad-hoc commands -1276 */ -1277 -1278 /** -1279 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -1280 * The command will not be dispatched to nodes, but be executed on the RunDeck server. -1281 * -1282 * @param project name of the project - mandatory -1283 * @param command to be executed - mandatory -1284 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1285 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1286 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1287 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1288 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1289 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) -1290 * @see #runAdhocCommand(String, String) -1291 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library -1292 */ -1293 public RundeckExecution triggerAdhocCommand(String project, String command) throws RundeckApiException, -1294 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1295 return triggerAdhocCommand(project, command, null); -1296 } -1297 -1298 /** -1299 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -1300 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1301 * -1302 * @param project name of the project - mandatory -1303 * @param command to be executed - mandatory -1304 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1305 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1306 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1307 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1308 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1309 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1310 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) -1311 * @see #runAdhocCommand(String, String, Properties) -1312 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library -1313 */ -1314 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters) -1315 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1316 return triggerAdhocCommand(project, command, nodeFilters, null, null); -1317 } -1318 -1319 /** -1320 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -1321 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1322 * -1323 * @param project name of the project - mandatory -1324 * @param command to be executed - mandatory -1325 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1326 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1327 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1328 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1329 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1330 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1331 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1332 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1333 * @see #triggerAdhocCommand(String, String) -1334 * @see #runAdhocCommand(String, String, Properties) -1335 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library -1336 */ -1337 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters, -1338 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException, -1339 RundeckApiTokenException, IllegalArgumentException { -1340 return triggerAdhocCommand(project, command, nodeFilters, nodeThreadcount, nodeKeepgoing, null); -1341 } -1342 /** -1343 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -1344 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1345 * -1346 * @param project name of the project - mandatory -1347 * @param command to be executed - mandatory -1348 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1349 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1350 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1351 * @param asUser specify a user name to run the job as, must have 'runAs' permission -1352 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1353 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1354 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1355 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1356 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1357 * @see #triggerAdhocCommand(String, String) -1358 * @see #runAdhocCommand(String, String, Properties) -1359 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library -1360 */ -1361 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters, -1362 Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser) throws RundeckApiException, RundeckApiLoginException, -1363 RundeckApiTokenException, IllegalArgumentException { -1364 return triggerAdhocCommand(RunAdhocCommandBuilder.builder() -1365 .setProject(project) -1366 .setCommand(command) -1367 .setNodeFilters(nodeFilters) -1368 .setNodeThreadcount(nodeThreadcount) -1369 .setNodeKeepgoing(nodeKeepgoing) -1370 .setAsUser(asUser) -1371 .build()); -1372 } -1373 /** -1374 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -1375 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1376 * -1377 * @param command the RunAdhocCommand. Project and command are mandatory, see {@link RunAdhocCommandBuilder} -1378 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1379 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1380 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1381 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1382 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1383 * @see #triggerAdhocCommand(String, String) -1384 * @see #runAdhocCommand(String, String, Properties) -1385 */ -1386 public RundeckExecution triggerAdhocCommand(RunAdhocCommand command) throws RundeckApiException, RundeckApiLoginException, -1387 RundeckApiTokenException, IllegalArgumentException { -1388 AssertUtil.notBlank(command.getProject(), "project is mandatory to trigger an ad-hoc command !"); -1389 AssertUtil.notBlank(command.getCommand(), "command is mandatory to trigger an ad-hoc command !"); -1390 ApiPathBuilder apiPath = new ApiPathBuilder("/run/command").param("project", command.getProject()) -1391 .param("exec", command.getCommand()) -1392 .param("nodeThreadcount", -1393 command.getNodeThreadcount()) -1394 .param("nodeKeepgoing", -1395 command.getNodeKeepgoing()) -1396 .nodeFilters(command.getNodeFilters()); -1397 if(null!= command.getAsUser()) { -1398 apiPath.param("asUser", command.getAsUser()); -1399 } -1400 RundeckExecution execution = new ApiCall(this).get(apiPath, new ExecutionParser("result/execution")); -1401 // the first call just returns the ID of the execution, so we need another call to get a "real" execution -1402 return getExecution(execution.getId()); -1403 } -1404 -1405 /** -1406 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1407 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -1408 * running. The command will not be dispatched to nodes, but be executed on the RunDeck server. -1409 * -1410 * @param project name of the project - mandatory -1411 * @param command to be executed - mandatory -1412 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1413 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1414 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1415 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1416 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1417 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) -1418 * @see #triggerAdhocCommand(String, String) -1419 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand)}, this method will -1420 * be removed in version 10 of this library -1421 */ -1422 public RundeckExecution runAdhocCommand(String project, String command) throws RundeckApiException, -1423 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1424 return runAdhocCommand(project, command, null); -1425 } -1426 -1427 /** -1428 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1429 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -1430 * finished (or aborted) or is still running. The command will not be dispatched to nodes, but be executed on the -1431 * RunDeck server. -1432 * -1433 * @param project name of the project - mandatory -1434 * @param command to be executed - mandatory -1435 * @param poolingInterval for checking the status of the execution. Must be > 0. -1436 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1437 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1438 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1439 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1440 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1441 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1442 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) -1443 * @see #triggerAdhocCommand(String, String) -1444 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will -1445 * be removed in version 10 of this library -1446 */ -1447 public RundeckExecution runAdhocCommand(String project, String command, long poolingInterval, TimeUnit poolingUnit) -1448 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1449 return runAdhocCommand(project, command, null, poolingInterval, poolingUnit); -1450 } -1451 -1452 /** -1453 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1454 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -1455 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1456 * -1457 * @param project name of the project - mandatory -1458 * @param command to be executed - mandatory -1459 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1460 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1461 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1462 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1463 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1464 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1465 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) -1466 * @see #triggerAdhocCommand(String, String, Properties) -1467 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand)}, this method will -1468 * be removed in version 10 of this library -1469 */ -1470 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters) -1471 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1472 return runAdhocCommand(project, command, nodeFilters, null, null); -1473 } -1474 -1475 /** -1476 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1477 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -1478 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the -1479 * nodeFilters parameter. -1480 * -1481 * @param project name of the project - mandatory -1482 * @param command to be executed - mandatory -1483 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1484 * @param poolingInterval for checking the status of the execution. Must be > 0. -1485 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1486 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1487 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1488 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1489 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1490 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1491 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) -1492 * @see #triggerAdhocCommand(String, String, Properties) -1493 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will -1494 * be removed in version 10 of this library -1495 */ -1496 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, -1497 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, -1498 RundeckApiTokenException, IllegalArgumentException { -1499 return runAdhocCommand(project, command, nodeFilters, null, null, poolingInterval, poolingUnit); -1500 } -1501 -1502 /** -1503 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1504 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -1505 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1506 * -1507 * @param project name of the project - mandatory -1508 * @param command to be executed - mandatory -1509 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1510 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1511 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1512 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1513 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1514 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1515 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1516 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1517 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) -1518 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) -1519 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand)}, this method will -1520 * be removed in version 10 of this library -1521 */ -1522 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, -1523 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException, -1524 RundeckApiTokenException, IllegalArgumentException { -1525 return runAdhocCommand(project, -1526 command, -1527 nodeFilters, -1528 nodeThreadcount, -1529 nodeKeepgoing, -1530 DEFAULT_POOLING_INTERVAL, -1531 DEFAULT_POOLING_UNIT); -1532 } -1533 -1534 /** -1535 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1536 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -1537 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -1538 * -1539 * @param command the RunAdhocCommand, see {@link RunAdhocCommandBuilder} -1540 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1541 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1542 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1543 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1544 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1545 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) -1546 * @see #triggerAdhocCommand(RunAdhocCommand) -1547 */ -1548 public RundeckExecution runAdhocCommand(RunAdhocCommand command) throws RundeckApiException, RundeckApiLoginException, -1549 RundeckApiTokenException, IllegalArgumentException { -1550 return runAdhocCommand(command, -1551 DEFAULT_POOLING_INTERVAL, -1552 DEFAULT_POOLING_UNIT); -1553 } -1554 -1555 /** -1556 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1557 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -1558 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the -1559 * nodeFilters parameter. -1560 * -1561 * @param project name of the project - mandatory -1562 * @param command to be executed - mandatory -1563 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1564 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1565 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1566 * @param poolingInterval for checking the status of the execution. Must be > 0. -1567 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1568 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1569 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1570 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1571 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1572 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1573 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) -1574 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will -1575 * be removed in version 10 of this library -1576 */ -1577 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, -1578 Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, TimeUnit poolingUnit) -1579 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1580 return runAdhocCommand(project, command, nodeFilters, nodeThreadcount, nodeKeepgoing, null, poolingInterval, poolingUnit); -1581 } -1582 -1583 /** -1584 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1585 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -1586 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the -1587 * nodeFilters parameter. -1588 * -1589 * @param project name of the project - mandatory -1590 * @param command to be executed - mandatory -1591 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1592 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1593 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1594 * @param poolingInterval for checking the status of the execution. Must be > 0. -1595 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1596 * -1597 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1598 * -1599 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1600 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1601 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1602 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1603 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) -1604 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will -1605 * be removed in version 10 of this library -1606 */ -1607 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, -1608 Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser, long poolingInterval, TimeUnit poolingUnit) -1609 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1610 return runAdhocCommand(RunAdhocCommandBuilder.builder() -1611 .setProject(project) -1612 .setCommand(command) -1613 .setNodeFilters(nodeFilters) -1614 .setNodeThreadcount(nodeThreadcount) -1615 .setNodeKeepgoing(nodeKeepgoing) -1616 .setAsUser(asUser) -1617 .build(), poolingInterval, poolingUnit); -1618 } -1619 /** -1620 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -1621 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -1622 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the -1623 * nodeFilters parameter. -1624 * -1625 * @param command the RunAdhocCommand, see {@link RunAdhocCommandBuilder} -1626 * @param poolingInterval for checking the status of the execution. Must be > 0. -1627 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -1628 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -1629 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1630 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1631 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1632 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -1633 * @see #triggerAdhocCommand(RunAdhocCommand) -1634 */ -1635 public RundeckExecution runAdhocCommand(RunAdhocCommand command, long poolingInterval, TimeUnit poolingUnit) -1636 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1637 if (poolingInterval <= 0) { -1638 poolingInterval = DEFAULT_POOLING_INTERVAL; -1639 poolingUnit = DEFAULT_POOLING_UNIT; -1640 } -1641 if (poolingUnit == null) { -1642 poolingUnit = DEFAULT_POOLING_UNIT; -1643 } -1644 -1645 RundeckExecution execution = triggerAdhocCommand(command); -1646 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { -1647 try { -1648 Thread.sleep(poolingUnit.toMillis(poolingInterval)); -1649 } catch (InterruptedException e) { -1650 break; -1651 } -1652 execution = getExecution(execution.getId()); -1653 } -1654 return execution; -1655 } -1656 -1657 /* -1658 * Ad-hoc scripts -1659 */ -1660 -1661 /** -1662 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1663 * script will not be dispatched to nodes, but be executed on the RunDeck server. -1664 * -1665 * @param project name of the project - mandatory -1666 * @param scriptFilename filename of the script to be executed - mandatory -1667 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1668 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1669 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1670 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1671 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -1672 * @throws IOException if we failed to read the file -1673 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -1674 * @see #runAdhocScript(String, String) -1675 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1676 * removed in version 10 of this library -1677 */ -1678 public RundeckExecution triggerAdhocScript(String project, String scriptFilename) throws RundeckApiException, -1679 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -1680 return triggerAdhocScript(project, scriptFilename, null); -1681 } -1682 -1683 /** -1684 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1685 * script will not be dispatched to nodes, but be executed on the RunDeck server. -1686 * -1687 * @param project name of the project - mandatory -1688 * @param scriptFilename filename of the script to be executed - mandatory -1689 * @param options of the script - optional. See {@link OptionsBuilder}. -1690 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1691 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1692 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1693 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1694 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -1695 * @throws IOException if we failed to read the file -1696 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -1697 * @see #runAdhocScript(String, String, Properties) -1698 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1699 * removed in version 10 of this library -1700 */ -1701 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options) -1702 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, -1703 IOException { -1704 return triggerAdhocScript(project, scriptFilename, options, null); -1705 } -1706 -1707 /** -1708 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1709 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1710 * -1711 * @param project name of the project - mandatory -1712 * @param scriptFilename filename of the script to be executed - mandatory -1713 * @param options of the script - optional. See {@link OptionsBuilder}. -1714 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1715 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1716 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1717 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1718 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1719 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -1720 * @throws IOException if we failed to read the file -1721 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -1722 * @see #runAdhocScript(String, String, Properties, Properties) -1723 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1724 * removed in version 10 of this library -1725 */ -1726 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options, -1727 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -1728 IllegalArgumentException, IOException { -1729 return triggerAdhocScript(project, scriptFilename, options, nodeFilters, null, null); -1730 } -1731 -1732 /** -1733 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1734 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1735 * -1736 * @param project name of the project - mandatory -1737 * @param scriptFilename filename of the script to be executed - mandatory -1738 * @param options of the script - optional. See {@link OptionsBuilder}. -1739 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1740 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1741 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1742 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1743 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1744 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1745 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1746 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -1747 * @throws IOException if we failed to read the file -1748 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -1749 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -1750 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1751 * removed in version 10 of this library -1752 */ -1753 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options, -1754 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, -1755 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -1756 return triggerAdhocScript(project, scriptFilename, options, nodeFilters, nodeThreadcount, nodeKeepgoing, null); -1757 } -1758 /** -1759 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1760 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1761 * -1762 * @param project name of the project - mandatory -1763 * @param scriptFilename filename of the script to be executed - mandatory -1764 * @param options of the script - optional. See {@link OptionsBuilder}. -1765 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1766 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1767 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1768 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1769 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1770 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1771 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1772 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -1773 * @throws IOException if we failed to read the file -1774 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -1775 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -1776 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1777 * removed in version 10 of this library -1778 */ -1779 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options, -1780 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing,String asUser) throws RundeckApiException, -1781 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -1782 return triggerAdhocScript(project, scriptFilename, ParametersUtil.generateArgString(options), nodeFilters, -1783 nodeThreadcount, nodeKeepgoing, asUser); -1784 } -1785 /** -1786 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1787 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1788 * -1789 * @param project name of the project - mandatory -1790 * @param scriptFilename filename of the script to be executed - mandatory -1791 * @param argString arguments of the script - optional. -1792 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1793 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1794 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1795 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1796 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1797 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1798 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1799 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -1800 * @throws IOException if we failed to read the file -1801 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -1802 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -1803 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1804 * removed in version 10 of this library -1805 */ -1806 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, String argString, -1807 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing,String asUser) throws RundeckApiException, -1808 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -1809 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to trigger an ad-hoc script !"); -1810 FileInputStream stream = null; -1811 try { -1812 stream = FileUtils.openInputStream(new File(scriptFilename)); -1813 return triggerAdhocScript(RunAdhocScriptBuilder.builder() -1814 .setProject(project) -1815 .setScript(stream) -1816 .setNodeFilters(nodeFilters) -1817 .setArgString(argString) -1818 .setNodeThreadcount(nodeThreadcount) -1819 .setNodeKeepgoing(nodeKeepgoing) -1820 .setAsUser(asUser) -1821 .build()); -1822 } finally { -1823 IOUtils.closeQuietly(stream); -1824 } -1825 } -1826 -1827 /** -1828 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1829 * script will not be dispatched to nodes, but be executed on the RunDeck server. -1830 * -1831 * @param project name of the project - mandatory -1832 * @param script inputStream for reading the script to be executed - mandatory -1833 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1834 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1835 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1836 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1837 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1838 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -1839 * @see #runAdhocScript(String, InputStream) -1840 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1841 * removed in version 10 of this library -1842 */ -1843 public RundeckExecution triggerAdhocScript(String project, InputStream script) throws RundeckApiException, -1844 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1845 return triggerAdhocScript(project, script, null); -1846 } -1847 -1848 /** -1849 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1850 * script will not be dispatched to nodes, but be executed on the RunDeck server. -1851 * -1852 * @param project name of the project - mandatory -1853 * @param script inputStream for reading the script to be executed - mandatory -1854 * @param options of the script - optional. See {@link OptionsBuilder}. -1855 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1856 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1857 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1858 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1859 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1860 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -1861 * @see #runAdhocScript(String, InputStream, Properties) -1862 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1863 * removed in version 10 of this library -1864 */ -1865 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options) -1866 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1867 return triggerAdhocScript(project, script, options, null); -1868 } -1869 -1870 /** -1871 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1872 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1873 * -1874 * @param project name of the project - mandatory -1875 * @param script inputStream for reading the script to be executed - mandatory -1876 * @param options of the script - optional. See {@link OptionsBuilder}. -1877 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1878 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1879 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1880 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1881 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1882 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1883 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -1884 * @see #runAdhocScript(String, InputStream, Properties, Properties) -1885 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1886 * removed in version 10 of this library -1887 */ -1888 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options, -1889 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -1890 IllegalArgumentException { -1891 return triggerAdhocScript(project, script, options, nodeFilters, null, null); -1892 } -1893 -1894 /** -1895 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1896 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1897 * -1898 * @param project name of the project - mandatory -1899 * @param script inputStream for reading the script to be executed - mandatory -1900 * @param options of the script - optional. See {@link OptionsBuilder}. -1901 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1902 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1903 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1904 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1905 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1906 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1907 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1908 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1909 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -1910 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -1911 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1912 * removed in version 10 of this library -1913 */ -1914 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options, -1915 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, -1916 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1917 return triggerAdhocScript(project, script, options, nodeFilters, nodeThreadcount, nodeKeepgoing, null); -1918 } -1919 /** -1920 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1921 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1922 * -1923 * @param project name of the project - mandatory -1924 * @param script inputStream for reading the script to be executed - mandatory -1925 * @param options of the script - optional. See {@link OptionsBuilder}. -1926 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1927 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1928 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1929 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1930 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1931 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1932 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1933 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1934 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -1935 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -1936 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1937 * removed in version 10 of this library -1938 */ -1939 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options, -1940 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser) throws RundeckApiException, -1941 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1942 return triggerAdhocScript(project, script, ParametersUtil.generateArgString(options), nodeFilters, -1943 nodeThreadcount, nodeKeepgoing, asUser); -1944 } -1945 /** -1946 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -1947 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1948 * -1949 * @param project name of the project - mandatory -1950 * @param script inputStream for reading the script to be executed - mandatory -1951 * @param argString arguments of the script - optional. -1952 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -1953 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -1954 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -1955 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -1956 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1957 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1958 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1959 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1960 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -1961 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -1962 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be -1963 * removed in version 10 of this library -1964 */ -1965 public RundeckExecution triggerAdhocScript(String project, InputStream script, String argString, -1966 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser) throws RundeckApiException, -1967 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -1968 return triggerAdhocScript(RunAdhocScriptBuilder.builder() -1969 .setProject(project) -1970 .setScript(script) -1971 .setNodeFilters(nodeFilters) -1972 .setArgString(argString) -1973 .setNodeThreadcount(nodeThreadcount) -1974 .setNodeKeepgoing(nodeKeepgoing) -1975 .setAsUser(asUser) -1976 .build()); -1977 } -1978 -1979 /** -1980 * Trigger the execution of an ad-hoc script read from a file, and return immediately (without waiting the end of -1981 * the execution). The script will be dispatched to nodes, accordingly to the nodeFilters parameter. -1982 * -1983 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} -1984 * @param scriptFilename a file to read as the input script stream -1985 * -1986 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +221 +222 public RundeckClient(String url, String token) throws IllegalArgumentException { +223 this(url, token, null, true); +224 } +225 +226 /** +227 * Used by RundeckClientBuilder +228 */ +229 RundeckClient(final String url) throws IllegalArgumentException { +230 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !"); +231 this.url=url; +232 } +233 +234 /** +235 * Create a builder for RundeckClient +236 */ +237 public static RundeckClientBuilder builder() { +238 return new RundeckClientBuilder(); +239 } +240 +241 /** +242 * Try to "ping" the RunDeck instance to see if it is alive +243 * +244 * @throws RundeckApiException if the ping fails +245 */ +246 public void ping() throws RundeckApiException { +247 new ApiCall(this).ping(); +248 } +249 +250 /** +251 * Test the authentication on the RunDeck instance. +252 * +253 * @return sessionID if doing username+password login and it succeeded +254 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +255 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +256 */ +257 public String testAuth() throws RundeckApiLoginException, RundeckApiTokenException { +258 return (new ApiCall(this)).testAuth(); +259 } +260 +261 /** +262 * @deprecated Use {@link #testAuth()} +263 * @see #testAuth() +264 */ +265 @Deprecated +266 public void testCredentials() throws RundeckApiLoginException, RundeckApiTokenException { +267 testAuth(); +268 } +269 +270 /* +271 * Projects +272 */ +273 +274 /** +275 * List all projects +276 * +277 * @return a {@link List} of {@link RundeckProject} : might be empty, but won't be null +278 * @throws RundeckApiException in case of error when calling the API +279 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +280 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +281 */ +282 public List<RundeckProject> getProjects() throws RundeckApiException, RundeckApiLoginException, +283 RundeckApiTokenException { +284 return new ApiCall(this).get(new ApiPathBuilder("/projects"), +285 new ListParser<RundeckProject>(new ProjectParser(), "result/projects/project")); +286 } +287 +288 /** +289 * Get the definition of a single project, identified by the given name +290 * +291 * @param projectName name of the project - mandatory +292 * @return a {@link RundeckProject} instance - won't be null +293 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +294 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +295 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +296 * @throws IllegalArgumentException if the projectName is blank (null, empty or whitespace) +297 */ +298 public RundeckProject getProject(String projectName) throws RundeckApiException, RundeckApiLoginException, +299 RundeckApiTokenException, IllegalArgumentException { +300 AssertUtil.notBlank(projectName, "projectName is mandatory to get the details of a project !"); +301 return new ApiCall(this).get(new ApiPathBuilder("/project/", projectName), +302 new ProjectParser("result/projects/project")); +303 } +304 +305 /* +306 * Jobs +307 */ +308 +309 /** +310 * List all jobs (for all projects) +311 * +312 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null +313 * @throws RundeckApiException in case of error when calling the API +314 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +315 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +316 */ +317 public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException { +318 List<RundeckJob> jobs = new ArrayList<RundeckJob>(); +319 for (RundeckProject project : getProjects()) { +320 jobs.addAll(getJobs(project.getName())); +321 } +322 return jobs; +323 } +324 +325 /** +326 * List all jobs that belongs to the given project +327 * +328 * @param project name of the project - mandatory +329 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null +330 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +331 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +332 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +333 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +334 * @see #getJobs(String, String, String, String...) +335 */ +336 public List<RundeckJob> getJobs(String project) throws RundeckApiException, RundeckApiLoginException, +337 RundeckApiTokenException, IllegalArgumentException { +338 return getJobs(project, null, null, new String[0]); +339 } +340 +341 /** +342 * List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds) +343 * +344 * @param project name of the project - mandatory +345 * @param jobFilter a filter for the job Name - optional +346 * @param groupPath a group or partial group path to include all jobs within that group path - optional +347 * @param jobIds a list of Job IDs to include - optional +348 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null +349 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +350 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +351 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +352 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +353 * @see #getJobs(String) +354 */ +355 public List<RundeckJob> getJobs(String project, String jobFilter, String groupPath, String... jobIds) +356 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +357 AssertUtil.notBlank(project, "project is mandatory to get all jobs !"); +358 return new ApiCall(this).get(new ApiPathBuilder("/jobs").param("project", project) +359 .param("jobFilter", jobFilter) +360 .param("groupPath", groupPath) +361 .param("idlist", StringUtils.join(jobIds, ",")), +362 new ListParser<RundeckJob>(new JobParser(), "result/jobs/job")); +363 } +364 +365 /** +366 * Export the definitions of all jobs that belongs to the given project +367 * +368 * @param filename path of the file where the content should be saved - mandatory +369 * @param format of the export. See {@link FileType} - mandatory +370 * @param project name of the project - mandatory +371 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +372 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +373 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +374 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is +375 * invalid +376 * @throws IOException if we failed to write to the file +377 * @see #exportJobsToFile(String, FileType, String, String, String, String...) +378 * @see #exportJobs(String, String) +379 */ +380 public void exportJobsToFile(String filename, String format, String project) throws RundeckApiException, +381 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +382 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); +383 exportJobsToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), project); +384 } +385 +386 /** +387 * Export the definitions of all jobs that belongs to the given project +388 * +389 * @param filename path of the file where the content should be saved - mandatory +390 * @param format of the export. See {@link FileType} - mandatory +391 * @param project name of the project - mandatory +392 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +393 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +394 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +395 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null +396 * @throws IOException if we failed to write to the file +397 * @see #exportJobsToFile(String, FileType, String, String, String, String...) +398 * @see #exportJobs(FileType, String) +399 */ +400 public void exportJobsToFile(String filename, FileType format, String project) throws RundeckApiException, +401 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +402 exportJobsToFile(filename, format, project, null, null, new String[0]); +403 } +404 +405 /** +406 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, +407 * groupPath and jobIds) +408 * +409 * @param filename path of the file where the content should be saved - mandatory +410 * @param format of the export. See {@link FileType} - mandatory +411 * @param project name of the project - mandatory +412 * @param jobFilter a filter for the job Name - optional +413 * @param groupPath a group or partial group path to include all jobs within that group path - optional +414 * @param jobIds a list of Job IDs to include - optional +415 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +416 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +417 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +418 * @throws IllegalArgumentException if the filename, format or project is blank (null, empty or whitespace), or the +419 * format is invalid +420 * @throws IOException if we failed to write to the file +421 * @see #exportJobsToFile(String, FileType, String, String, String, String...) +422 * @see #exportJobs(FileType, String, String, String, String...) +423 */ +424 public void exportJobsToFile(String filename, String format, String project, String jobFilter, String groupPath, +425 String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +426 IllegalArgumentException, IOException { +427 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); +428 exportJobsToFile(filename, +429 FileType.valueOf(StringUtils.upperCase(format)), +430 project, +431 jobFilter, +432 groupPath, +433 jobIds); +434 } +435 +436 /** +437 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, +438 * groupPath and jobIds) +439 * +440 * @param filename path of the file where the content should be saved - mandatory +441 * @param format of the export. See {@link FileType} - mandatory +442 * @param project name of the project - mandatory +443 * @param jobFilter a filter for the job Name - optional +444 * @param groupPath a group or partial group path to include all jobs within that group path - optional +445 * @param jobIds a list of Job IDs to include - optional +446 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +447 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +448 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +449 * @throws IllegalArgumentException if the filename or project is blank (null, empty or whitespace), or the format +450 * is null +451 * @throws IOException if we failed to write to the file +452 * @see #exportJobs(FileType, String, String, String, String...) +453 */ +454 public void exportJobsToFile(String filename, FileType format, String project, String jobFilter, String groupPath, +455 String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +456 IllegalArgumentException, IOException { +457 AssertUtil.notBlank(filename, "filename is mandatory to export a job !"); +458 InputStream inputStream = exportJobs(format, project, jobFilter, groupPath, jobIds); +459 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream)); +460 } +461 +462 /** +463 * Export the definitions of all jobs that belongs to the given project +464 * +465 * @param format of the export. See {@link FileType} - mandatory +466 * @param project name of the project - mandatory +467 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +468 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +469 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +470 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +471 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is +472 * invalid +473 * @see #exportJobs(FileType, String, String, String, String...) +474 * @see #exportJobsToFile(String, String, String) +475 */ +476 public InputStream exportJobs(String format, String project) throws RundeckApiException, RundeckApiLoginException, +477 RundeckApiTokenException, IllegalArgumentException { +478 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); +479 return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project); +480 } +481 +482 /** +483 * Export the definitions of all jobs that belongs to the given project +484 * +485 * @param format of the export. See {@link FileType} - mandatory +486 * @param project name of the project - mandatory +487 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +488 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +489 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +490 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +491 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null +492 * @see #exportJobs(FileType, String, String, String, String...) +493 * @see #exportJobsToFile(String, FileType, String) +494 */ +495 public InputStream exportJobs(FileType format, String project) throws RundeckApiException, +496 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +497 return exportJobs(format, project, null, null, new String[0]); +498 } +499 +500 /** +501 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, +502 * groupPath and jobIds) +503 * +504 * @param format of the export. See {@link FileType} - mandatory +505 * @param project name of the project - mandatory +506 * @param jobFilter a filter for the job Name - optional +507 * @param groupPath a group or partial group path to include all jobs within that group path - optional +508 * @param jobIds a list of Job IDs to include - optional +509 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +510 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +511 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +512 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +513 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is +514 * invalid +515 * @see #exportJobs(FileType, String, String, String, String...) +516 * @see #exportJobsToFile(String, String, String, String, String, String...) +517 */ +518 public InputStream exportJobs(String format, String project, String jobFilter, String groupPath, String... jobIds) +519 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +520 AssertUtil.notBlank(format, "format is mandatory to export jobs !"); +521 return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project, jobFilter, groupPath, jobIds); +522 } +523 +524 /** +525 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, +526 * groupPath and jobIds) +527 * +528 * @param format of the export. See {@link FileType} - mandatory +529 * @param project name of the project - mandatory +530 * @param jobFilter a filter for the job Name - optional +531 * @param groupPath a group or partial group path to include all jobs within that group path - optional +532 * @param jobIds a list of Job IDs to include - optional +533 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +534 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +535 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +536 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +537 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null +538 * @see #exportJobsToFile(String, FileType, String, String, String, String...) +539 */ +540 public InputStream exportJobs(FileType format, String project, String jobFilter, String groupPath, String... jobIds) +541 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +542 AssertUtil.notNull(format, "format is mandatory to export jobs !"); +543 AssertUtil.notBlank(project, "project is mandatory to export jobs !"); +544 return new ApiCall(this).get(new ApiPathBuilder("/jobs/export").param("format", format) +545 .param("project", project) +546 .param("jobFilter", jobFilter) +547 .param("groupPath", groupPath) +548 .param("idlist", StringUtils.join(jobIds, ","))); +549 } +550 +551 /** +552 * Export the definition of a single job (identified by the given ID) +553 * +554 * @param filename path of the file where the content should be saved - mandatory +555 * @param format of the export. See {@link FileType} - mandatory +556 * @param jobId identifier of the job - mandatory +557 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +558 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +559 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +560 * @throws IllegalArgumentException if the filename, format or jobId is blank (null, empty or whitespace), or the +561 * format is invalid +562 * @throws IOException if we failed to write to the file +563 * @see #exportJobToFile(String, FileType, String) +564 * @see #exportJob(String, String) +565 * @see #getJob(String) +566 */ +567 public void exportJobToFile(String filename, String format, String jobId) throws RundeckApiException, +568 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +569 AssertUtil.notBlank(format, "format is mandatory to export a job !"); +570 exportJobToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), jobId); +571 } +572 +573 /** +574 * Export the definition of a single job (identified by the given ID) +575 * +576 * @param filename path of the file where the content should be saved - mandatory +577 * @param format of the export. See {@link FileType} - mandatory +578 * @param jobId identifier of the job - mandatory +579 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +580 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +581 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +582 * @throws IllegalArgumentException if the filename or jobId is blank (null, empty or whitespace), or the format is +583 * null +584 * @throws IOException if we failed to write to the file +585 * @see #exportJob(FileType, String) +586 * @see #getJob(String) +587 */ +588 public void exportJobToFile(String filename, FileType format, String jobId) throws RundeckApiException, +589 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +590 AssertUtil.notBlank(filename, "filename is mandatory to export a job !"); +591 InputStream inputStream = exportJob(format, jobId); +592 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream)); +593 } +594 +595 /** +596 * Export the definition of a single job, identified by the given ID +597 * +598 * @param format of the export. See {@link FileType} - mandatory +599 * @param jobId identifier of the job - mandatory +600 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +601 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +602 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +603 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +604 * @throws IllegalArgumentException if the format or jobId is blank (null, empty or whitespace), or the format is +605 * invalid +606 * @see #exportJobToFile(String, String, String) +607 * @see #getJob(String) +608 */ +609 public InputStream exportJob(String format, String jobId) throws RundeckApiException, RundeckApiLoginException, +610 RundeckApiTokenException, IllegalArgumentException { +611 AssertUtil.notBlank(format, "format is mandatory to export a job !"); +612 return exportJob(FileType.valueOf(StringUtils.upperCase(format)), jobId); +613 } +614 +615 /** +616 * Export the definition of a single job, identified by the given ID +617 * +618 * @param format of the export. See {@link FileType} - mandatory +619 * @param jobId identifier of the job - mandatory +620 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +621 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +622 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +623 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +624 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the format is null +625 * @see #exportJobToFile(String, FileType, String) +626 * @see #getJob(String) +627 */ +628 public InputStream exportJob(FileType format, String jobId) throws RundeckApiException, RundeckApiLoginException, +629 RundeckApiTokenException, IllegalArgumentException { +630 AssertUtil.notNull(format, "format is mandatory to export a job !"); +631 AssertUtil.notBlank(jobId, "jobId is mandatory to export a job !"); +632 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId).param("format", format)); +633 } +634 +635 /** +636 * Import the definitions of jobs, from the given file +637 * +638 * @param filename of the file containing the jobs definitions - mandatory +639 * @param fileType type of the file. See {@link FileType} - mandatory +640 * @return a {@link RundeckJobsImportResult} instance - won't be null +641 * @throws RundeckApiException in case of error when calling the API +642 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +643 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +644 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the +645 * fileType is invalid +646 * @throws IOException if we failed to read the file +647 * @see #importJobs(InputStream, String) +648 * @see #importJobs(String, FileType, RundeckJobsImportMethod) +649 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this library. +650 */ +651 public RundeckJobsImportResult importJobs(String filename, String fileType) throws RundeckApiException, +652 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +653 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); +654 return importJobs(filename, FileType.valueOf(StringUtils.upperCase(fileType))); +655 } +656 +657 /** +658 * Import the definitions of jobs, from the given file +659 * +660 * @param filename of the file containing the jobs definitions - mandatory +661 * @param fileType type of the file. See {@link FileType} - mandatory +662 * @return a {@link RundeckJobsImportResult} instance - won't be null +663 * @throws RundeckApiException in case of error when calling the API +664 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +665 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +666 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null +667 * @throws IOException if we failed to read the file +668 * @see #importJobs(InputStream, FileType) +669 * @see #importJobs(String, FileType, RundeckJobsImportMethod) +670 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this +671 * library. +672 */ +673 public RundeckJobsImportResult importJobs(String filename, FileType fileType) throws RundeckApiException, +674 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +675 return importJobs(filename, fileType, (RundeckJobsImportMethod) null); +676 } +677 +678 /** +679 * Import the definitions of jobs, from the given file, using the given behavior +680 * +681 * @param filename of the file containing the jobs definitions - mandatory +682 * @param fileType type of the file. See {@link FileType} - mandatory +683 * @param importBehavior see {@link RundeckJobsImportMethod} +684 * @return a {@link RundeckJobsImportResult} instance - won't be null +685 * @throws RundeckApiException in case of error when calling the API +686 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +687 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +688 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the +689 * fileType or behavior is not valid +690 * @throws IOException if we failed to read the file +691 * @see #importJobs(InputStream, String, String) +692 * @see #importJobs(String, FileType, RundeckJobsImportMethod) +693 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this +694 * library. +695 */ +696 public RundeckJobsImportResult importJobs(String filename, String fileType, String importBehavior) +697 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, +698 IOException { +699 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); +700 return importJobs(filename, +701 FileType.valueOf(StringUtils.upperCase(fileType)), +702 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior))); +703 } +704 +705 /** +706 * Import the definitions of jobs, from the given file, using the given behavior +707 * +708 * @param filename of the file containing the jobs definitions - mandatory +709 * @param fileType type of the file. See {@link FileType} - mandatory +710 * @param importBehavior see {@link RundeckJobsImportMethod} +711 * @return a {@link RundeckJobsImportResult} instance - won't be null +712 * @throws RundeckApiException in case of error when calling the API +713 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +714 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +715 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null +716 * @throws IOException if we failed to read the file +717 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) +718 * @deprecated use {@link #importJobs(String, RundeckJobsImport)}, this method will be removed in version 10 of +719 * this library. +720 */ +721 public RundeckJobsImportResult importJobs(String filename, FileType fileType, RundeckJobsImportMethod importBehavior) +722 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, +723 IOException { +724 AssertUtil.notBlank(filename, "filename (of jobs file) is mandatory to import jobs !"); +725 FileInputStream stream = null; +726 try { +727 stream = FileUtils.openInputStream(new File(filename)); +728 return importJobs(stream, fileType, importBehavior); +729 } finally { +730 IOUtils.closeQuietly(stream); +731 } +732 } +733 +734 /** +735 * Import the definitions of jobs, from the given input stream +736 * +737 * @param stream inputStream for reading the definitions - mandatory +738 * @param fileType type of the file. See {@link FileType} - mandatory +739 * @return a {@link RundeckJobsImportResult} instance - won't be null +740 * @throws RundeckApiException in case of error when calling the API +741 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +742 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +743 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace) or +744 * invalid +745 * @see #importJobs(String, String) +746 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) +747 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this +748 * library. +749 */ +750 public RundeckJobsImportResult importJobs(InputStream stream, String fileType) throws RundeckApiException, +751 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +752 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); +753 return importJobs(stream, FileType.valueOf(StringUtils.upperCase(fileType))); +754 } +755 +756 /** +757 * Import the definitions of jobs, from the given input stream +758 * +759 * @param stream inputStream for reading the definitions - mandatory +760 * @param fileType type of the file. See {@link FileType} - mandatory +761 * @return a {@link RundeckJobsImportResult} instance - won't be null +762 * @throws RundeckApiException in case of error when calling the API +763 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +764 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +765 * @throws IllegalArgumentException if the stream or fileType is null +766 * @see #importJobs(String, FileType) +767 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) +768 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this +769 * library. +770 */ +771 public RundeckJobsImportResult importJobs(InputStream stream, FileType fileType) throws RundeckApiException, +772 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +773 return importJobs(stream, fileType, (RundeckJobsImportMethod) null); +774 } +775 +776 /** +777 * Import the definitions of jobs, from the given input stream, using the given behavior +778 * +779 * @param stream inputStream for reading the definitions - mandatory +780 * @param fileType type of the file. See {@link FileType} - mandatory +781 * @param importBehavior see {@link RundeckJobsImportMethod} +782 * @return a {@link RundeckJobsImportResult} instance - won't be null +783 * @throws RundeckApiException in case of error when calling the API +784 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +785 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +786 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace), or +787 * the fileType or behavior is not valid +788 * @see #importJobs(String, String, String) +789 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod) +790 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this +791 * library. +792 */ +793 public RundeckJobsImportResult importJobs(InputStream stream, String fileType, String importBehavior) +794 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +795 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !"); +796 return importJobs(stream, +797 FileType.valueOf(StringUtils.upperCase(fileType)), +798 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior))); +799 } +800 +801 /** +802 * Import the definitions of jobs, from the given input stream, using the given behavior +803 * +804 * @param stream inputStream for reading the definitions - mandatory +805 * @param fileType type of the file. See {@link FileType} - mandatory +806 * @param importBehavior see {@link RundeckJobsImportMethod} +807 * @return a {@link RundeckJobsImportResult} instance - won't be null +808 * @throws RundeckApiException in case of error when calling the API +809 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +810 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +811 * @throws IllegalArgumentException if the stream or fileType is null +812 * @see #importJobs(String, FileType, RundeckJobsImportMethod) +813 * @deprecated use {@link #importJobs(RundeckJobsImport)}, this method will be removed in version 10 of this +814 * library. +815 */ +816 public RundeckJobsImportResult importJobs(InputStream stream, FileType fileType, +817 RundeckJobsImportMethod importBehavior) throws RundeckApiException, RundeckApiLoginException, +818 RundeckApiTokenException, IllegalArgumentException { +819 return importJobs(RundeckJobsImportBuilder.builder().setStream(stream).setFileType(fileType) +820 .setJobsImportMethod(importBehavior).build()); +821 } +822 +823 /** +824 * Import the definitions of jobs, from the given input stream, using the given behavior +825 * +826 * @param rundeckJobsImport import request, see {@link RundeckJobsImportBuilder} +827 * +828 * @return a {@link RundeckJobsImportResult} instance - won't be null +829 * +830 * @throws RundeckApiException in case of error when calling the API +831 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +832 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +833 * @throws IllegalArgumentException if the stream or fileType is null +834 * @see #importJobs(String, FileType, RundeckJobsImportMethod) +835 */ +836 public RundeckJobsImportResult importJobs(final String filename,final RundeckJobsImport rundeckJobsImport) throws RundeckApiException, +837 RundeckApiLoginException, +838 RundeckApiTokenException, IllegalArgumentException, IOException { +839 AssertUtil.notBlank(filename, "filename (of jobs file) is mandatory to import jobs !"); +840 FileInputStream stream = null; +841 try { +842 stream = FileUtils.openInputStream(new File(filename)); +843 return importJobs(RundeckJobsImportBuilder.builder(rundeckJobsImport).setStream(stream).build()); +844 } finally { +845 +846 IOUtils.closeQuietly(stream); +847 } +848 } +849 /** +850 * Import the definitions of jobs, from the given input stream, using the given behavior +851 * +852 * @param rundeckJobsImport import request, see {@link RundeckJobsImportBuilder} +853 * +854 * @return a {@link RundeckJobsImportResult} instance - won't be null +855 * +856 * @throws RundeckApiException in case of error when calling the API +857 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +858 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +859 * @throws IllegalArgumentException if the stream or fileType is null +860 * @see #importJobs(String, FileType, RundeckJobsImportMethod) +861 */ +862 public RundeckJobsImportResult importJobs(final RundeckJobsImport rundeckJobsImport) throws RundeckApiException, +863 RundeckApiLoginException, +864 RundeckApiTokenException, IllegalArgumentException { +865 +866 AssertUtil.notNull(rundeckJobsImport.getStream(), "inputStream of jobs is mandatory to import jobs !"); +867 AssertUtil.notNull(rundeckJobsImport.getFileType(), "fileType is mandatory to import jobs !"); +868 final ApiPathBuilder request = new ApiPathBuilder(JOBS_IMPORT) +869 .param("format", rundeckJobsImport.getFileType()) +870 .param("dupeOption", rundeckJobsImport.getImportMethod()) +871 .attach("xmlBatch", rundeckJobsImport.getStream()); +872 if(null!=rundeckJobsImport.getUuidImportBehavior()) { +873 //API v9 +874 request.param("uuidOption", rundeckJobsImport.getUuidImportBehavior()); +875 } +876 if(null!=rundeckJobsImport.getProject()) { +877 //API v8 +878 request.param("project", rundeckJobsImport.getProject()); +879 } +880 return new ApiCall(this).post(request, new JobsImportResultParser("result")); +881 } +882 +883 /** +884 * Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not +885 * need to belong to a group (either pass null, or an empty string). +886 * +887 * @param project name of the project - mandatory +888 * @param groupPath group to which the job belongs (if it belongs to a group) - optional +889 * @param name of the job to find - mandatory +890 * @return a {@link RundeckJob} instance - null if not found +891 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +892 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +893 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +894 * @throws IllegalArgumentException if the project or the name is blank (null, empty or whitespace) +895 * @see #getJob(String) +896 */ +897 public RundeckJob findJob(String project, String groupPath, String name) throws RundeckApiException, +898 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +899 AssertUtil.notBlank(project, "project is mandatory to find a job !"); +900 AssertUtil.notBlank(name, "job name is mandatory to find a job !"); +901 List<RundeckJob> jobs = getJobs(project, name, groupPath, new String[0]); +902 return jobs.isEmpty() ? null : jobs.get(0); +903 } +904 +905 /** +906 * Get the definition of a single job, identified by the given ID +907 * +908 * @param jobId identifier of the job - mandatory +909 * @return a {@link RundeckJob} instance - won't be null +910 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +911 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +912 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +913 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +914 * @see #findJob(String, String, String) +915 * @see #exportJob(String, String) +916 */ +917 public RundeckJob getJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +918 RundeckApiTokenException, IllegalArgumentException { +919 AssertUtil.notBlank(jobId, "jobId is mandatory to get the details of a job !"); +920 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId), new JobParser("joblist/job")); +921 } +922 +923 /** +924 * Delete a single job, identified by the given ID +925 * +926 * @param jobId identifier of the job - mandatory +927 * @return the success message (note that in case of error, you'll get an exception) +928 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +929 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +930 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +931 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +932 */ +933 public String deleteJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +934 RundeckApiTokenException, IllegalArgumentException { +935 AssertUtil.notBlank(jobId, "jobId is mandatory to delete a job !"); +936 return new ApiCall(this).delete(new ApiPathBuilder("/job/", jobId), new StringParser("result/success/message")); +937 } +938 /** +939 * Delete multiple jobs, identified by the given IDs +940 * +941 * @param jobIds List of job IDS +942 * @return the bulk delete result +943 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +944 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +945 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +946 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +947 */ +948 public RundeckJobDeleteBulk deleteJobs(final List<String> jobIds) throws RundeckApiException, RundeckApiLoginException, +949 RundeckApiTokenException, IllegalArgumentException { +950 if (null == jobIds || 0 == jobIds.size()) { +951 throw new IllegalArgumentException("jobIds are mandatory to delete a job"); +952 } +953 return new ApiCall(this).post(new ApiPathBuilder("/jobs/delete").field("ids",jobIds), +954 new BulkDeleteParser("result/deleteJobs")); +955 } +956 +957 /** +958 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +959 * end of the job execution) +960 * +961 * @param jobId identifier of the job - mandatory +962 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +963 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +964 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +965 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +966 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +967 * @see #triggerJob(String, Properties, Properties) +968 * @see #runJob(String) +969 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library +970 */ +971 public RundeckExecution triggerJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +972 RundeckApiTokenException, IllegalArgumentException { +973 return triggerJob(jobId, null); +974 } +975 +976 /** +977 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +978 * end of the job execution) +979 * +980 * @param jobId identifier of the job - mandatory +981 * @param options of the job - optional. See {@link OptionsBuilder}. +982 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +983 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +984 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +985 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +986 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +987 * @see #triggerJob(String, Properties, Properties) +988 * @see #runJob(String, Properties) +989 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library +990 */ +991 public RundeckExecution triggerJob(String jobId, Properties options) throws RundeckApiException, +992 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +993 return triggerJob(jobId, options, null); +994 } +995 +996 /** +997 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +998 * end of the job execution) +999 * +1000 * @param jobId identifier of the job - mandatory +1001 * @param options of the job - optional. See {@link OptionsBuilder}. +1002 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +1003 * {@link NodeFiltersBuilder} +1004 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1005 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1006 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1007 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1008 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1009 * @see #triggerJob(String) +1010 * @see #runJob(String, Properties, Properties) +1011 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library +1012 */ +1013 public RundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters) +1014 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1015 return triggerJob(jobId, options, nodeFilters, null); +1016 } +1017 /** +1018 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +1019 * end of the job execution) +1020 * +1021 * @param jobId identifier of the job - mandatory +1022 * @param options of the job - optional. See {@link OptionsBuilder}. +1023 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +1024 * {@link NodeFiltersBuilder} +1025 * @param asUser specify a user name to run the job as, must have 'runAs' permission +1026 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1027 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1028 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1029 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1030 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1031 * @see #triggerJob(String) +1032 * @see #runJob(String, Properties, Properties) +1033 * @deprecated use {@link #triggerJob(RunJob)}, this method will be removed in version 10 of this library +1034 */ +1035 public RundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters, String asUser) +1036 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1037 return triggerJob(RunJobBuilder.builder() +1038 .setJobId(jobId) +1039 .setOptions(options) +1040 .setNodeFilters(nodeFilters) +1041 .setAsUser(asUser) +1042 .build()); +1043 } +1044 /** +1045 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +1046 * end of the job execution) +1047 * +1048 * @param jobRun the RunJob, see {@link RunJobBuilder} +1049 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1050 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1051 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1052 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1053 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1054 * @see #triggerJob(String) +1055 * @see #runJob(String, Properties, Properties) +1056 */ +1057 public RundeckExecution triggerJob(final RunJob jobRun) +1058 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1059 AssertUtil.notBlank(jobRun.getJobId(), "jobId is mandatory to trigger a job !"); +1060 ApiPathBuilder apiPath = new ApiPathBuilder("/job/", jobRun.getJobId(), "/run").param("argString", +1061 ParametersUtil.generateArgString(jobRun.getOptions())) +1062 .nodeFilters(jobRun.getNodeFilters()); +1063 if(null!=jobRun.getAsUser()) { +1064 apiPath.param("asUser", jobRun.getAsUser()); +1065 } +1066 return new ApiCall(this).get(apiPath, new ExecutionParser("result/executions/execution")); +1067 } +1068 +1069 /** +1070 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1071 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +1072 * aborted) or is still running. +1073 * +1074 * @param jobId identifier of the job - mandatory +1075 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1076 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1077 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1078 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1079 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1080 * @see #triggerJob(String) +1081 * @see #runJob(String, Properties, Properties, long, TimeUnit) +1082 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, +1083 * this method will be removed in version 10 of this library +1084 */ +1085 public RundeckExecution runJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +1086 RundeckApiTokenException, IllegalArgumentException { +1087 return runJob(jobId, null); +1088 } +1089 +1090 /** +1091 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1092 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +1093 * aborted) or is still running. +1094 * +1095 * @param jobId identifier of the job - mandatory +1096 * @param options of the job - optional. See {@link OptionsBuilder}. +1097 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1098 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1099 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1100 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1101 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1102 * @see #triggerJob(String, Properties) +1103 * @see #runJob(String, Properties, Properties, long, TimeUnit) +1104 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, +1105 * this method will be removed in version 10 of this library +1106 */ +1107 public RundeckExecution runJob(String jobId, Properties options) throws RundeckApiException, +1108 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1109 return runJob(jobId, options, null); +1110 } +1111 +1112 /** +1113 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1114 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +1115 * aborted) or is still running. +1116 * +1117 * @param jobId identifier of the job - mandatory +1118 * @param options of the job - optional. See {@link OptionsBuilder}. +1119 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +1120 * {@link NodeFiltersBuilder} +1121 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1122 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1123 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1124 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1125 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1126 * @see #triggerJob(String, Properties, Properties) +1127 * @see #runJob(String, Properties, Properties, long, TimeUnit) +1128 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, +1129 * this method will be removed in version 10 of this library +1130 */ +1131 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters) +1132 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1133 return runJob(jobId, options, nodeFilters, DEFAULT_POOLING_INTERVAL, DEFAULT_POOLING_UNIT); +1134 } +1135 +1136 /** +1137 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1138 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +1139 * aborted) or is still running. +1140 * +1141 * @param runJob the RunJob, see {@link RunJobBuilder} +1142 * +1143 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1144 * +1145 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1146 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1147 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1148 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1149 * @see #triggerJob(RunJob) +1150 * @see #runJob(RunJob, long, TimeUnit) +1151 */ +1152 public RundeckExecution runJob(final RunJob runJob) throws RundeckApiException, RundeckApiLoginException, +1153 RundeckApiTokenException, IllegalArgumentException { +1154 return runJob(runJob, DEFAULT_POOLING_INTERVAL, DEFAULT_POOLING_UNIT); +1155 } +1156 /** +1157 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1158 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to +1159 * know if the execution is finished (or aborted) or is still running. +1160 * +1161 * @param jobId identifier of the job - mandatory +1162 * @param options of the job - optional. See {@link OptionsBuilder}. +1163 * @param poolingInterval for checking the status of the execution. Must be > 0. +1164 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1165 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1166 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1167 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1168 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1169 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1170 * @see #triggerJob(String, Properties) +1171 * @see #runJob(String, Properties, Properties, long, TimeUnit) +1172 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, +1173 * this method will be removed in version 10 of this library +1174 */ +1175 public RundeckExecution runJob(String jobId, Properties options, long poolingInterval, TimeUnit poolingUnit) +1176 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1177 return runJob(jobId, options, null, poolingInterval, poolingUnit); +1178 } +1179 +1180 /** +1181 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1182 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to +1183 * know if the execution is finished (or aborted) or is still running. +1184 * +1185 * @param jobId identifier of the job - mandatory +1186 * @param options of the job - optional. See {@link OptionsBuilder}. +1187 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +1188 * {@link NodeFiltersBuilder} +1189 * @param poolingInterval for checking the status of the execution. Must be > 0. +1190 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1191 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1192 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1193 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1194 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1195 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1196 * @see #triggerJob(String, Properties) +1197 * @see #runJob(String, Properties, Properties, long, TimeUnit) +1198 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, +1199 * this method will be removed in version 10 of this library +1200 */ +1201 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, long poolingInterval, +1202 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +1203 IllegalArgumentException { +1204 return runJob(jobId, options, nodeFilters, null, poolingInterval, poolingUnit); +1205 } +1206 /** +1207 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1208 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to +1209 * know if the execution is finished (or aborted) or is still running. +1210 * +1211 * @param jobId identifier of the job - mandatory +1212 * @param options of the job - optional. See {@link OptionsBuilder}. +1213 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +1214 * {@link NodeFiltersBuilder} +1215 * @param asUser specify a user name to run the job as, must have 'runAs' permission +1216 * @param poolingInterval for checking the status of the execution. Must be > 0. +1217 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1218 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1219 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1220 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1221 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1222 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1223 * @see #triggerJob(String, Properties) +1224 * @see #runJob(String, Properties, Properties, long, TimeUnit) +1225 * @deprecated use {@link #runJob(RunJob, long, java.util.concurrent.TimeUnit)}, this method will be removed in version 10 of this library +1226 */ +1227 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, String asUser, long poolingInterval, +1228 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +1229 IllegalArgumentException { +1230 return runJob(RunJobBuilder.builder() +1231 .setJobId(jobId) +1232 .setOptions(options) +1233 .setNodeFilters(nodeFilters) +1234 .setAsUser(asUser) +1235 .build(), poolingInterval, poolingUnit); +1236 } +1237 +1238 /** +1239 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +1240 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to +1241 * know if the execution is finished (or aborted) or is still running. +1242 * +1243 * @param jobRun the RunJob, see {@link RunJobBuilder} +1244 * @param poolingInterval for checking the status of the execution. Must be > 0. +1245 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1246 * +1247 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1248 * +1249 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +1250 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1251 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1252 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +1253 * @see #triggerJob(RunJob) +1254 */ +1255 public RundeckExecution runJob(final RunJob jobRun, long poolingInterval, +1256 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +1257 IllegalArgumentException { +1258 +1259 if (poolingInterval <= 0) { +1260 poolingInterval = DEFAULT_POOLING_INTERVAL; +1261 poolingUnit = DEFAULT_POOLING_UNIT; +1262 } +1263 if (poolingUnit == null) { +1264 poolingUnit = DEFAULT_POOLING_UNIT; +1265 } +1266 +1267 RundeckExecution execution = triggerJob(jobRun); +1268 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { +1269 try { +1270 Thread.sleep(poolingUnit.toMillis(poolingInterval)); +1271 } catch (InterruptedException e) { +1272 break; +1273 } +1274 execution = getExecution(execution.getId()); +1275 } +1276 return execution; +1277 } +1278 +1279 /* +1280 * Ad-hoc commands +1281 */ +1282 +1283 /** +1284 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +1285 * The command will not be dispatched to nodes, but be executed on the RunDeck server. +1286 * +1287 * @param project name of the project - mandatory +1288 * @param command to be executed - mandatory +1289 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1290 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1291 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1292 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1293 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1294 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) +1295 * @see #runAdhocCommand(String, String) +1296 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library +1297 */ +1298 public RundeckExecution triggerAdhocCommand(String project, String command) throws RundeckApiException, +1299 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1300 return triggerAdhocCommand(project, command, null); +1301 } +1302 +1303 /** +1304 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +1305 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1306 * +1307 * @param project name of the project - mandatory +1308 * @param command to be executed - mandatory +1309 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1310 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1311 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1312 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1313 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1314 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1315 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) +1316 * @see #runAdhocCommand(String, String, Properties) +1317 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library +1318 */ +1319 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters) +1320 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1321 return triggerAdhocCommand(project, command, nodeFilters, null, null); +1322 } +1323 +1324 /** +1325 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +1326 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1327 * +1328 * @param project name of the project - mandatory +1329 * @param command to be executed - mandatory +1330 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1331 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1332 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1333 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1334 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1335 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1336 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1337 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1338 * @see #triggerAdhocCommand(String, String) +1339 * @see #runAdhocCommand(String, String, Properties) +1340 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library +1341 */ +1342 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters, +1343 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException, +1344 RundeckApiTokenException, IllegalArgumentException { +1345 return triggerAdhocCommand(project, command, nodeFilters, nodeThreadcount, nodeKeepgoing, null); +1346 } +1347 /** +1348 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +1349 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1350 * +1351 * @param project name of the project - mandatory +1352 * @param command to be executed - mandatory +1353 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1354 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1355 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1356 * @param asUser specify a user name to run the job as, must have 'runAs' permission +1357 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1358 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1359 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1360 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1361 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1362 * @see #triggerAdhocCommand(String, String) +1363 * @see #runAdhocCommand(String, String, Properties) +1364 * @deprecated use {@link #triggerAdhocCommand(RunAdhocCommand)}, will be removed in version 10 of this library +1365 */ +1366 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters, +1367 Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser) throws RundeckApiException, RundeckApiLoginException, +1368 RundeckApiTokenException, IllegalArgumentException { +1369 return triggerAdhocCommand(RunAdhocCommandBuilder.builder() +1370 .setProject(project) +1371 .setCommand(command) +1372 .setNodeFilters(nodeFilters) +1373 .setNodeThreadcount(nodeThreadcount) +1374 .setNodeKeepgoing(nodeKeepgoing) +1375 .setAsUser(asUser) +1376 .build()); +1377 } +1378 /** +1379 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +1380 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1381 * +1382 * @param command the RunAdhocCommand. Project and command are mandatory, see {@link RunAdhocCommandBuilder} +1383 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1384 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1385 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1386 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1387 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1388 * @see #triggerAdhocCommand(String, String) +1389 * @see #runAdhocCommand(String, String, Properties) +1390 */ +1391 public RundeckExecution triggerAdhocCommand(RunAdhocCommand command) throws RundeckApiException, RundeckApiLoginException, +1392 RundeckApiTokenException, IllegalArgumentException { +1393 AssertUtil.notBlank(command.getProject(), "project is mandatory to trigger an ad-hoc command !"); +1394 AssertUtil.notBlank(command.getCommand(), "command is mandatory to trigger an ad-hoc command !"); +1395 ApiPathBuilder apiPath = new ApiPathBuilder("/run/command").param("project", command.getProject()) +1396 .param("exec", command.getCommand()) +1397 .param("nodeThreadcount", +1398 command.getNodeThreadcount()) +1399 .param("nodeKeepgoing", +1400 command.getNodeKeepgoing()) +1401 .nodeFilters(command.getNodeFilters()); +1402 if(null!= command.getAsUser()) { +1403 apiPath.param("asUser", command.getAsUser()); +1404 } +1405 RundeckExecution execution = new ApiCall(this).get(apiPath, new ExecutionParser("result/execution")); +1406 // the first call just returns the ID of the execution, so we need another call to get a "real" execution +1407 return getExecution(execution.getId()); +1408 } +1409 +1410 /** +1411 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1412 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +1413 * running. The command will not be dispatched to nodes, but be executed on the RunDeck server. +1414 * +1415 * @param project name of the project - mandatory +1416 * @param command to be executed - mandatory +1417 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1418 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1419 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1420 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1421 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1422 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) +1423 * @see #triggerAdhocCommand(String, String) +1424 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand)}, this method will +1425 * be removed in version 10 of this library +1426 */ +1427 public RundeckExecution runAdhocCommand(String project, String command) throws RundeckApiException, +1428 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1429 return runAdhocCommand(project, command, null); +1430 } +1431 +1432 /** +1433 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1434 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +1435 * finished (or aborted) or is still running. The command will not be dispatched to nodes, but be executed on the +1436 * RunDeck server. +1437 * +1438 * @param project name of the project - mandatory +1439 * @param command to be executed - mandatory +1440 * @param poolingInterval for checking the status of the execution. Must be > 0. +1441 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1442 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1443 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1444 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1445 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1446 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1447 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) +1448 * @see #triggerAdhocCommand(String, String) +1449 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will +1450 * be removed in version 10 of this library +1451 */ +1452 public RundeckExecution runAdhocCommand(String project, String command, long poolingInterval, TimeUnit poolingUnit) +1453 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1454 return runAdhocCommand(project, command, null, poolingInterval, poolingUnit); +1455 } +1456 +1457 /** +1458 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1459 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +1460 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1461 * +1462 * @param project name of the project - mandatory +1463 * @param command to be executed - mandatory +1464 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1465 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1466 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1467 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1468 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1469 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1470 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) +1471 * @see #triggerAdhocCommand(String, String, Properties) +1472 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand)}, this method will +1473 * be removed in version 10 of this library +1474 */ +1475 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters) +1476 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1477 return runAdhocCommand(project, command, nodeFilters, null, null); +1478 } +1479 +1480 /** +1481 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1482 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +1483 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the +1484 * nodeFilters parameter. +1485 * +1486 * @param project name of the project - mandatory +1487 * @param command to be executed - mandatory +1488 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1489 * @param poolingInterval for checking the status of the execution. Must be > 0. +1490 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1491 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1492 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1493 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1494 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1495 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1496 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) +1497 * @see #triggerAdhocCommand(String, String, Properties) +1498 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will +1499 * be removed in version 10 of this library +1500 */ +1501 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, +1502 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, +1503 RundeckApiTokenException, IllegalArgumentException { +1504 return runAdhocCommand(project, command, nodeFilters, null, null, poolingInterval, poolingUnit); +1505 } +1506 +1507 /** +1508 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1509 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +1510 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1511 * +1512 * @param project name of the project - mandatory +1513 * @param command to be executed - mandatory +1514 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1515 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1516 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1517 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1518 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1519 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1520 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1521 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1522 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) +1523 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) +1524 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand)}, this method will +1525 * be removed in version 10 of this library +1526 */ +1527 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, +1528 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException, +1529 RundeckApiTokenException, IllegalArgumentException { +1530 return runAdhocCommand(project, +1531 command, +1532 nodeFilters, +1533 nodeThreadcount, +1534 nodeKeepgoing, +1535 DEFAULT_POOLING_INTERVAL, +1536 DEFAULT_POOLING_UNIT); +1537 } +1538 +1539 /** +1540 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1541 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +1542 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +1543 * +1544 * @param command the RunAdhocCommand, see {@link RunAdhocCommandBuilder} +1545 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1546 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1547 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1548 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1549 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1550 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit) +1551 * @see #triggerAdhocCommand(RunAdhocCommand) +1552 */ +1553 public RundeckExecution runAdhocCommand(RunAdhocCommand command) throws RundeckApiException, RundeckApiLoginException, +1554 RundeckApiTokenException, IllegalArgumentException { +1555 return runAdhocCommand(command, +1556 DEFAULT_POOLING_INTERVAL, +1557 DEFAULT_POOLING_UNIT); +1558 } +1559 +1560 /** +1561 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1562 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +1563 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the +1564 * nodeFilters parameter. +1565 * +1566 * @param project name of the project - mandatory +1567 * @param command to be executed - mandatory +1568 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1569 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1570 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1571 * @param poolingInterval for checking the status of the execution. Must be > 0. +1572 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1573 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1574 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1575 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1576 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1577 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1578 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) +1579 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will +1580 * be removed in version 10 of this library +1581 */ +1582 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, +1583 Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, TimeUnit poolingUnit) +1584 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1585 return runAdhocCommand(project, command, nodeFilters, nodeThreadcount, nodeKeepgoing, null, poolingInterval, poolingUnit); +1586 } +1587 +1588 /** +1589 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1590 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +1591 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the +1592 * nodeFilters parameter. +1593 * +1594 * @param project name of the project - mandatory +1595 * @param command to be executed - mandatory +1596 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1597 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1598 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1599 * @param poolingInterval for checking the status of the execution. Must be > 0. +1600 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1601 * +1602 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1603 * +1604 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1605 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1606 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1607 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1608 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean) +1609 * @deprecated use {@link #runAdhocCommand(RunAdhocCommand, long, java.util.concurrent.TimeUnit)}, this method will +1610 * be removed in version 10 of this library +1611 */ +1612 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, +1613 Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser, long poolingInterval, TimeUnit poolingUnit) +1614 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1615 return runAdhocCommand(RunAdhocCommandBuilder.builder() +1616 .setProject(project) +1617 .setCommand(command) +1618 .setNodeFilters(nodeFilters) +1619 .setNodeThreadcount(nodeThreadcount) +1620 .setNodeKeepgoing(nodeKeepgoing) +1621 .setAsUser(asUser) +1622 .build(), poolingInterval, poolingUnit); +1623 } +1624 /** +1625 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +1626 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +1627 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the +1628 * nodeFilters parameter. +1629 * +1630 * @param command the RunAdhocCommand, see {@link RunAdhocCommandBuilder} +1631 * @param poolingInterval for checking the status of the execution. Must be > 0. +1632 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1633 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +1634 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1635 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1636 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1637 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +1638 * @see #triggerAdhocCommand(RunAdhocCommand) +1639 */ +1640 public RundeckExecution runAdhocCommand(RunAdhocCommand command, long poolingInterval, TimeUnit poolingUnit) +1641 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1642 if (poolingInterval <= 0) { +1643 poolingInterval = DEFAULT_POOLING_INTERVAL; +1644 poolingUnit = DEFAULT_POOLING_UNIT; +1645 } +1646 if (poolingUnit == null) { +1647 poolingUnit = DEFAULT_POOLING_UNIT; +1648 } +1649 +1650 RundeckExecution execution = triggerAdhocCommand(command); +1651 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { +1652 try { +1653 Thread.sleep(poolingUnit.toMillis(poolingInterval)); +1654 } catch (InterruptedException e) { +1655 break; +1656 } +1657 execution = getExecution(execution.getId()); +1658 } +1659 return execution; +1660 } +1661 +1662 /* +1663 * Ad-hoc scripts +1664 */ +1665 +1666 /** +1667 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1668 * script will not be dispatched to nodes, but be executed on the RunDeck server. +1669 * +1670 * @param project name of the project - mandatory +1671 * @param scriptFilename filename of the script to be executed - mandatory +1672 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1673 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1674 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1675 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1676 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +1677 * @throws IOException if we failed to read the file +1678 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +1679 * @see #runAdhocScript(String, String) +1680 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1681 * removed in version 10 of this library +1682 */ +1683 public RundeckExecution triggerAdhocScript(String project, String scriptFilename) throws RundeckApiException, +1684 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +1685 return triggerAdhocScript(project, scriptFilename, null); +1686 } +1687 +1688 /** +1689 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1690 * script will not be dispatched to nodes, but be executed on the RunDeck server. +1691 * +1692 * @param project name of the project - mandatory +1693 * @param scriptFilename filename of the script to be executed - mandatory +1694 * @param options of the script - optional. See {@link OptionsBuilder}. +1695 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1696 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1697 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1698 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1699 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +1700 * @throws IOException if we failed to read the file +1701 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +1702 * @see #runAdhocScript(String, String, Properties) +1703 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1704 * removed in version 10 of this library +1705 */ +1706 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options) +1707 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, +1708 IOException { +1709 return triggerAdhocScript(project, scriptFilename, options, null); +1710 } +1711 +1712 /** +1713 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1714 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1715 * +1716 * @param project name of the project - mandatory +1717 * @param scriptFilename filename of the script to be executed - mandatory +1718 * @param options of the script - optional. See {@link OptionsBuilder}. +1719 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1720 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1721 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1722 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1723 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1724 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +1725 * @throws IOException if we failed to read the file +1726 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +1727 * @see #runAdhocScript(String, String, Properties, Properties) +1728 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1729 * removed in version 10 of this library +1730 */ +1731 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options, +1732 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +1733 IllegalArgumentException, IOException { +1734 return triggerAdhocScript(project, scriptFilename, options, nodeFilters, null, null); +1735 } +1736 +1737 /** +1738 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1739 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1740 * +1741 * @param project name of the project - mandatory +1742 * @param scriptFilename filename of the script to be executed - mandatory +1743 * @param options of the script - optional. See {@link OptionsBuilder}. +1744 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1745 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1746 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1747 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1748 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1749 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1750 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1751 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +1752 * @throws IOException if we failed to read the file +1753 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +1754 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +1755 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1756 * removed in version 10 of this library +1757 */ +1758 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options, +1759 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, +1760 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +1761 return triggerAdhocScript(project, scriptFilename, options, nodeFilters, nodeThreadcount, nodeKeepgoing, null); +1762 } +1763 /** +1764 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1765 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1766 * +1767 * @param project name of the project - mandatory +1768 * @param scriptFilename filename of the script to be executed - mandatory +1769 * @param options of the script - optional. See {@link OptionsBuilder}. +1770 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1771 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1772 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1773 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1774 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1775 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1776 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1777 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +1778 * @throws IOException if we failed to read the file +1779 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +1780 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +1781 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1782 * removed in version 10 of this library +1783 */ +1784 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options, +1785 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing,String asUser) throws RundeckApiException, +1786 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +1787 return triggerAdhocScript(project, scriptFilename, ParametersUtil.generateArgString(options), nodeFilters, +1788 nodeThreadcount, nodeKeepgoing, asUser); +1789 } +1790 /** +1791 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1792 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1793 * +1794 * @param project name of the project - mandatory +1795 * @param scriptFilename filename of the script to be executed - mandatory +1796 * @param argString arguments of the script - optional. +1797 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1798 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1799 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1800 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1801 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1802 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1803 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1804 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +1805 * @throws IOException if we failed to read the file +1806 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +1807 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +1808 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1809 * removed in version 10 of this library +1810 */ +1811 public RundeckExecution triggerAdhocScript(String project, String scriptFilename, String argString, +1812 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing,String asUser) throws RundeckApiException, +1813 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +1814 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to trigger an ad-hoc script !"); +1815 FileInputStream stream = null; +1816 try { +1817 stream = FileUtils.openInputStream(new File(scriptFilename)); +1818 return triggerAdhocScript(RunAdhocScriptBuilder.builder() +1819 .setProject(project) +1820 .setScript(stream) +1821 .setNodeFilters(nodeFilters) +1822 .setArgString(argString) +1823 .setNodeThreadcount(nodeThreadcount) +1824 .setNodeKeepgoing(nodeKeepgoing) +1825 .setAsUser(asUser) +1826 .build()); +1827 } finally { +1828 IOUtils.closeQuietly(stream); +1829 } +1830 } +1831 +1832 /** +1833 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1834 * script will not be dispatched to nodes, but be executed on the RunDeck server. +1835 * +1836 * @param project name of the project - mandatory +1837 * @param script inputStream for reading the script to be executed - mandatory +1838 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1839 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1840 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1841 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1842 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1843 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +1844 * @see #runAdhocScript(String, InputStream) +1845 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1846 * removed in version 10 of this library +1847 */ +1848 public RundeckExecution triggerAdhocScript(String project, InputStream script) throws RundeckApiException, +1849 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1850 return triggerAdhocScript(project, script, null); +1851 } +1852 +1853 /** +1854 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1855 * script will not be dispatched to nodes, but be executed on the RunDeck server. +1856 * +1857 * @param project name of the project - mandatory +1858 * @param script inputStream for reading the script to be executed - mandatory +1859 * @param options of the script - optional. See {@link OptionsBuilder}. +1860 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1861 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1862 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1863 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1864 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1865 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +1866 * @see #runAdhocScript(String, InputStream, Properties) +1867 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1868 * removed in version 10 of this library +1869 */ +1870 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options) +1871 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1872 return triggerAdhocScript(project, script, options, null); +1873 } +1874 +1875 /** +1876 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1877 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1878 * +1879 * @param project name of the project - mandatory +1880 * @param script inputStream for reading the script to be executed - mandatory +1881 * @param options of the script - optional. See {@link OptionsBuilder}. +1882 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1883 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1884 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1885 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1886 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1887 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1888 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +1889 * @see #runAdhocScript(String, InputStream, Properties, Properties) +1890 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1891 * removed in version 10 of this library +1892 */ +1893 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options, +1894 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +1895 IllegalArgumentException { +1896 return triggerAdhocScript(project, script, options, nodeFilters, null, null); +1897 } +1898 +1899 /** +1900 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1901 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1902 * +1903 * @param project name of the project - mandatory +1904 * @param script inputStream for reading the script to be executed - mandatory +1905 * @param options of the script - optional. See {@link OptionsBuilder}. +1906 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1907 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1908 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1909 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1910 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1911 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1912 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1913 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1914 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +1915 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +1916 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1917 * removed in version 10 of this library +1918 */ +1919 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options, +1920 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, +1921 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1922 return triggerAdhocScript(project, script, options, nodeFilters, nodeThreadcount, nodeKeepgoing, null); +1923 } +1924 /** +1925 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1926 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1927 * +1928 * @param project name of the project - mandatory +1929 * @param script inputStream for reading the script to be executed - mandatory +1930 * @param options of the script - optional. See {@link OptionsBuilder}. +1931 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1932 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1933 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1934 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1935 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1936 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1937 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1938 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1939 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +1940 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +1941 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1942 * removed in version 10 of this library +1943 */ +1944 public RundeckExecution triggerAdhocScript(String project, InputStream script, Properties options, +1945 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser) throws RundeckApiException, +1946 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1947 return triggerAdhocScript(project, script, ParametersUtil.generateArgString(options), nodeFilters, +1948 nodeThreadcount, nodeKeepgoing, asUser); +1949 } +1950 /** +1951 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +1952 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +1953 * +1954 * @param project name of the project - mandatory +1955 * @param script inputStream for reading the script to be executed - mandatory +1956 * @param argString arguments of the script - optional. +1957 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +1958 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +1959 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +1960 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1961 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1962 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1963 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1964 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1965 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +1966 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +1967 * @deprecated use {@link #triggerAdhocScript(RunAdhocScript)}, this method will be +1968 * removed in version 10 of this library +1969 */ +1970 public RundeckExecution triggerAdhocScript(String project, InputStream script, String argString, +1971 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser) throws RundeckApiException, +1972 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +1973 return triggerAdhocScript(RunAdhocScriptBuilder.builder() +1974 .setProject(project) +1975 .setScript(script) +1976 .setNodeFilters(nodeFilters) +1977 .setArgString(argString) +1978 .setNodeThreadcount(nodeThreadcount) +1979 .setNodeKeepgoing(nodeKeepgoing) +1980 .setAsUser(asUser) +1981 .build()); +1982 } +1983 +1984 /** +1985 * Trigger the execution of an ad-hoc script read from a file, and return immediately (without waiting the end of +1986 * the execution). The script will be dispatched to nodes, accordingly to the nodeFilters parameter. 1987 * -1988 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -1989 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -1990 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -1991 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -1992 * @throws IOException if an error occurs reading the script file -1993 * @see #triggerAdhocScript(RunAdhocScript) -1994 * @see #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit) -1995 */ -1996 public RundeckExecution triggerAdhocScript(final RunAdhocScript script, final String scriptFilename) throws -1997 RundeckApiException, -1998 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -1999 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to trigger an ad-hoc script !"); -2000 FileInputStream stream = null; -2001 try { -2002 stream = FileUtils.openInputStream(new File(scriptFilename)); -2003 return triggerAdhocScript(RunAdhocScriptBuilder.builder(script) -2004 .setScript(stream) -2005 .build()); -2006 } finally { -2007 IOUtils.closeQuietly(stream); -2008 } -2009 } -2010 /** -2011 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The -2012 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. -2013 * -2014 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} -2015 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -2016 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2017 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2018 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2019 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2020 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -2021 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2022 */ -2023 public RundeckExecution triggerAdhocScript(RunAdhocScript script) throws RundeckApiException, -2024 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2025 AssertUtil.notBlank(script.getProject(), "project is mandatory to trigger an ad-hoc script !"); -2026 AssertUtil.notNull(script.getScript(), "script is mandatory to trigger an ad-hoc script !"); -2027 ApiPathBuilder apiPath = new ApiPathBuilder("/run/script").param("project", script.getProject()) -2028 .attach("scriptFile", -2029 script.getScript()) -2030 .param("argString",script.getArgString()) -2031 .param("nodeThreadcount", -2032 script.getNodeThreadcount()) -2033 .param("nodeKeepgoing", -2034 script.getNodeKeepgoing()) -2035 .param("scriptInterpreter", -2036 script.getScriptInterpreter()) -2037 .param("interpreterArgsQuoted", -2038 script.getInterpreterArgsQuoted()) -2039 .nodeFilters(script.getNodeFilters()); -2040 if(null!=script.getAsUser()) { -2041 apiPath.param("asUser", script.getAsUser()); -2042 } -2043 RundeckExecution execution = new ApiCall(this).post(apiPath, new ExecutionParser("result/execution")); -2044 // the first call just returns the ID of the execution, so we need another call to get a "real" execution -2045 return getExecution(execution.getId()); -2046 } -2047 -2048 /** -2049 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2050 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2051 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. -2052 * -2053 * @param project name of the project - mandatory -2054 * @param scriptFilename filename of the script to be executed - mandatory -2055 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2056 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2057 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2058 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2059 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2060 * @throws IOException if we failed to read the file -2061 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2062 * @see #triggerAdhocScript(String, String) -2063 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2064 * removed in version 10 of this library -2065 */ -2066 public RundeckExecution runAdhocScript(String project, String scriptFilename) throws RundeckApiException, -2067 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2068 return runAdhocScript(project, scriptFilename, null); -2069 } -2070 -2071 /** -2072 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2073 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2074 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the -2075 * RunDeck server. -2076 * -2077 * @param project name of the project - mandatory -2078 * @param scriptFilename filename of the script to be executed - mandatory -2079 * @param poolingInterval for checking the status of the execution. Must be > 0. -2080 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2081 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2082 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2083 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2084 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2085 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2086 * @throws IOException if we failed to read the file -2087 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2088 * @see #triggerAdhocScript(String, String) -2089 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2090 * removed in version 10 of this library -2091 */ -2092 public RundeckExecution runAdhocScript(String project, String scriptFilename, long poolingInterval, -2093 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2094 IllegalArgumentException, IOException { -2095 return runAdhocScript(project, scriptFilename, null, poolingInterval, poolingUnit); -2096 } -2097 -2098 /** -2099 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2100 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2101 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. -2102 * -2103 * @param project name of the project - mandatory -2104 * @param scriptFilename filename of the script to be executed - mandatory -2105 * @param options of the script - optional. See {@link OptionsBuilder}. -2106 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2107 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2108 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2109 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2110 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2111 * @throws IOException if we failed to read the file -2112 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2113 * @see #triggerAdhocScript(String, String, Properties) -2114 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2115 * removed in version 10 of this library -2116 */ -2117 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options) -2118 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, -2119 IOException { -2120 return runAdhocScript(project, scriptFilename, options, null); -2121 } -2122 -2123 /** -2124 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2125 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2126 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the -2127 * RunDeck server. -2128 * -2129 * @param project name of the project - mandatory -2130 * @param scriptFilename filename of the script to be executed - mandatory -2131 * @param options of the script - optional. See {@link OptionsBuilder}. -2132 * @param poolingInterval for checking the status of the execution. Must be > 0. -2133 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2134 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2135 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2136 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2137 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2138 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2139 * @throws IOException if we failed to read the file -2140 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2141 * @see #triggerAdhocScript(String, String, Properties) -2142 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2143 * removed in version 10 of this library -2144 */ -2145 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, -2146 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, -2147 RundeckApiTokenException, IllegalArgumentException, IOException { -2148 return runAdhocScript(project, scriptFilename, options, null, poolingInterval, poolingUnit); -2149 } -2150 -2151 /** -2152 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2153 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2154 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. -2155 * -2156 * @param project name of the project - mandatory -2157 * @param scriptFilename filename of the script to be executed - mandatory -2158 * @param options of the script - optional. See {@link OptionsBuilder}. -2159 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2160 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2161 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2162 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2163 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2164 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2165 * @throws IOException if we failed to read the file -2166 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2167 * @see #triggerAdhocScript(String, String, Properties, Properties) -2168 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2169 * removed in version 10 of this library -2170 */ -2171 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, -2172 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2173 IllegalArgumentException, IOException { -2174 return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null); -2175 } -2176 -2177 /** -2178 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2179 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2180 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters -2181 * parameter. -2182 * -2183 * @param project name of the project - mandatory -2184 * @param scriptFilename filename of the script to be executed - mandatory -2185 * @param options of the script - optional. See {@link OptionsBuilder}. -2186 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2187 * @param poolingInterval for checking the status of the execution. Must be > 0. -2188 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2189 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2190 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2191 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2192 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2193 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2194 * @throws IOException if we failed to read the file -2195 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2196 * @see #triggerAdhocScript(String, String, Properties, Properties) -2197 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2198 * removed in version 10 of this library -2199 */ -2200 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, -2201 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, -2202 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2203 return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null, poolingInterval, poolingUnit); -2204 } -2205 -2206 /** -2207 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2208 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2209 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. -2210 * -2211 * @param project name of the project - mandatory -2212 * @param scriptFilename filename of the script to be executed - mandatory -2213 * @param options of the script - optional. See {@link OptionsBuilder}. -2214 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2215 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -2216 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -2217 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2218 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2219 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2220 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2221 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2222 * @throws IOException if we failed to read the file -2223 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2224 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -2225 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2226 * removed in version 10 of this library -2227 */ -2228 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, -2229 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, -2230 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2231 return runAdhocScript(project, -2232 scriptFilename, -2233 options, -2234 nodeFilters, -2235 nodeThreadcount, -2236 nodeKeepgoing, -2237 DEFAULT_POOLING_INTERVAL, -2238 DEFAULT_POOLING_UNIT); -2239 } -2240 -2241 /** -2242 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2243 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2244 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters -2245 * parameter. -2246 * -2247 * @param project name of the project - mandatory -2248 * @param scriptFilename filename of the script to be executed - mandatory -2249 * @param options of the script - optional. See {@link OptionsBuilder}. -2250 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2251 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -2252 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -2253 * @param poolingInterval for checking the status of the execution. Must be > 0. -2254 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2255 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2256 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2257 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2258 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2259 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) -2260 * @throws IOException if we failed to read the file -2261 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2262 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) -2263 * -2264 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2265 * removed in version 10 of this library -2266 */ -2267 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, -2268 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, -2269 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2270 IllegalArgumentException, IOException { -2271 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to run an ad-hoc script !"); -2272 FileInputStream stream = null; -2273 try { -2274 stream = FileUtils.openInputStream(new File(scriptFilename)); -2275 return runAdhocScript(RunAdhocScriptBuilder.builder() -2276 .setProject(project) -2277 .setScript(stream) -2278 .setNodeFilters(nodeFilters) -2279 .setArgString(ParametersUtil.generateArgString(options)) -2280 .setNodeThreadcount(nodeThreadcount) -2281 .setNodeKeepgoing(nodeKeepgoing) -2282 .build(), -2283 poolingInterval, -2284 poolingUnit); -2285 } finally { -2286 IOUtils.closeQuietly(stream); -2287 } -2288 } -2289 -2290 /** -2291 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2292 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2293 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. -2294 * -2295 * @param project name of the project - mandatory -2296 * @param script inputStream for reading the script to be executed - mandatory -2297 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2298 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2299 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2300 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2301 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2302 * @throws IOException if we failed to read the file -2303 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2304 * @see #triggerAdhocScript(String, InputStream) -2305 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2306 * removed in version 10 of this library -2307 */ -2308 public RundeckExecution runAdhocScript(String project, InputStream script) throws RundeckApiException, -2309 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2310 return runAdhocScript(project, script, null); -2311 } -2312 -2313 /** -2314 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2315 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2316 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the -2317 * RunDeck server. -2318 * -2319 * @param project name of the project - mandatory -2320 * @param script inputStream for reading the script to be executed - mandatory -2321 * @param poolingInterval for checking the status of the execution. Must be > 0. -2322 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2323 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2324 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2325 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2326 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2327 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2328 * @throws IOException if we failed to read the file -2329 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2330 * @see #triggerAdhocScript(String, InputStream) -2331 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2332 * removed in version 10 of this library -2333 */ -2334 public RundeckExecution runAdhocScript(String project, InputStream script, long poolingInterval, -2335 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2336 IllegalArgumentException, IOException { -2337 return runAdhocScript(project, script, null, poolingInterval, poolingUnit); -2338 } -2339 -2340 /** -2341 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2342 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2343 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. -2344 * -2345 * @param project name of the project - mandatory -2346 * @param script inputStream for reading the script to be executed - mandatory -2347 * @param options of the script - optional. See {@link OptionsBuilder}. -2348 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2349 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2350 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2351 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2352 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2353 * @throws IOException if we failed to read the file -2354 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2355 * @see #triggerAdhocScript(String, InputStream, Properties) -2356 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2357 * removed in version 10 of this library -2358 */ -2359 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options) -2360 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, -2361 IOException { -2362 return runAdhocScript(project, script, options, null); -2363 } -2364 -2365 /** -2366 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2367 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2368 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the -2369 * RunDeck server. -2370 * -2371 * @param project name of the project - mandatory -2372 * @param script inputStream for reading the script to be executed - mandatory -2373 * @param options of the script - optional. See {@link OptionsBuilder}. -2374 * @param poolingInterval for checking the status of the execution. Must be > 0. -2375 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2376 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2377 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2378 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2379 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2380 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2381 * @throws IOException if we failed to read the file -2382 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2383 * @see #triggerAdhocScript(String, InputStream, Properties) -2384 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2385 * removed in version 10 of this library -2386 */ -2387 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, -2388 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, -2389 RundeckApiTokenException, IllegalArgumentException, IOException { -2390 return runAdhocScript(project, script, options, null, poolingInterval, poolingUnit); -2391 } -2392 -2393 /** -2394 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2395 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2396 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. -2397 * -2398 * @param project name of the project - mandatory -2399 * @param script inputStream for reading the script to be executed - mandatory -2400 * @param options of the script - optional. See {@link OptionsBuilder}. -2401 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2402 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2403 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2404 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2405 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2406 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2407 * @throws IOException if we failed to read the file -2408 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2409 * @see #triggerAdhocScript(String, InputStream, Properties, Properties) -2410 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2411 * removed in version 10 of this library -2412 */ -2413 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, -2414 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2415 IllegalArgumentException, IOException { -2416 return runAdhocScript(project, script, options, nodeFilters, null, null); -2417 } -2418 -2419 /** -2420 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2421 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2422 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters -2423 * parameter. -2424 * -2425 * @param project name of the project - mandatory -2426 * @param script inputStream for reading the script to be executed - mandatory -2427 * @param options of the script - optional. See {@link OptionsBuilder}. -2428 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2429 * @param poolingInterval for checking the status of the execution. Must be > 0. -2430 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2431 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2432 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2433 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2434 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2435 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2436 * @throws IOException if we failed to read the file -2437 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2438 * @see #triggerAdhocScript(String, InputStream, Properties, Properties) -2439 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2440 * removed in version 10 of this library -2441 */ -2442 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, -2443 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, -2444 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2445 return runAdhocScript(project, script, options, nodeFilters, null, null, poolingInterval, poolingUnit); -2446 } -2447 -2448 /** -2449 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2450 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2451 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. -2452 * -2453 * @param project name of the project - mandatory -2454 * @param script inputStream for reading the script to be executed - mandatory -2455 * @param options of the script - optional. See {@link OptionsBuilder}. -2456 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2457 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -2458 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -2459 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2460 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2461 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2462 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2463 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2464 * @throws IOException if we failed to read the file -2465 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) -2466 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -2467 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be -2468 * removed in version 10 of this library -2469 */ -2470 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, -2471 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, -2472 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2473 return runAdhocScript(project, -2474 script, -2475 options, -2476 nodeFilters, -2477 nodeThreadcount, -2478 nodeKeepgoing, -2479 DEFAULT_POOLING_INTERVAL, -2480 DEFAULT_POOLING_UNIT); -2481 } -2482 -2483 /** -2484 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2485 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -2486 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. -2487 * -2488 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} -2489 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2490 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2491 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2492 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2493 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2494 * @throws IOException if we failed to read the file -2495 * @see #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit) -2496 * @see #triggerAdhocScript(RunAdhocScript) -2497 */ -2498 public RundeckExecution runAdhocScript(RunAdhocScript script) throws RundeckApiException, -2499 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { -2500 return runAdhocScript(script, -2501 DEFAULT_POOLING_INTERVAL, -2502 DEFAULT_POOLING_UNIT); -2503 } -2504 -2505 /** -2506 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2507 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2508 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters -2509 * parameter. -2510 * -2511 * @param project name of the project - mandatory -2512 * @param script inputStream for reading the script to be executed - mandatory -2513 * @param options of the script - optional. See {@link OptionsBuilder}. -2514 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2515 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -2516 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -2517 * @param poolingInterval for checking the status of the execution. Must be > 0. -2518 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2519 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2520 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2521 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2522 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2523 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2524 * @throws IOException if we failed to read the file -2525 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2526 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -2527 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2528 * removed in version 10 of this library -2529 */ -2530 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, -2531 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, -2532 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2533 IllegalArgumentException { -2534 return runAdhocScript(project, script, options, nodeFilters, nodeThreadcount, nodeKeepgoing, null, poolingInterval, poolingUnit); -2535 } -2536 -2537 /** -2538 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2539 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2540 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters -2541 * parameter. -2542 * -2543 * @param project name of the project - mandatory -2544 * @param script inputStream for reading the script to be executed - mandatory -2545 * @param options of the script - optional. See {@link OptionsBuilder}. -2546 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} -2547 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional -2548 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional -2549 * @param poolingInterval for checking the status of the execution. Must be > 0. -2550 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2551 * -2552 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2553 * -2554 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2555 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2556 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2557 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2558 * @throws IOException if we failed to read the file -2559 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2560 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -2561 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be -2562 * removed in version 10 of this library -2563 */ -2564 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, -2565 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser, long poolingInterval, -2566 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2567 IllegalArgumentException { -2568 return runAdhocScript(RunAdhocScriptBuilder.builder() -2569 .setProject(project) -2570 .setScript(script) -2571 .setNodeFilters(nodeFilters) -2572 .setArgString(ParametersUtil.generateArgString(options)) -2573 .setNodeThreadcount(nodeThreadcount) -2574 .setNodeKeepgoing(nodeKeepgoing) -2575 .setAsUser(asUser) -2576 .build(), poolingInterval, poolingUnit); -2577 } -2578 -2579 /** -2580 * Run an ad-hoc script read from a file, and wait until its execution is finished (or aborted) to return. We will -2581 * poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the -2582 * execution is finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to -2583 * the nodeFilters parameter. -2584 * -2585 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} -2586 * @param scriptFilename filename of a script to read -2587 * @param poolingInterval for checking the status of the execution. Must be > 0. -2588 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +1988 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} +1989 * @param scriptFilename a file to read as the input script stream +1990 * +1991 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +1992 * +1993 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +1994 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +1995 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +1996 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +1997 * @throws IOException if an error occurs reading the script file +1998 * @see #triggerAdhocScript(RunAdhocScript) +1999 * @see #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit) +2000 */ +2001 public RundeckExecution triggerAdhocScript(final RunAdhocScript script, final String scriptFilename) throws +2002 RundeckApiException, +2003 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2004 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to trigger an ad-hoc script !"); +2005 FileInputStream stream = null; +2006 try { +2007 stream = FileUtils.openInputStream(new File(scriptFilename)); +2008 return triggerAdhocScript(RunAdhocScriptBuilder.builder(script) +2009 .setScript(stream) +2010 .build()); +2011 } finally { +2012 IOUtils.closeQuietly(stream); +2013 } +2014 } +2015 /** +2016 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The +2017 * script will be dispatched to nodes, accordingly to the nodeFilters parameter. +2018 * +2019 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} +2020 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +2021 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2022 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2023 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2024 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2025 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +2026 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2027 */ +2028 public RundeckExecution triggerAdhocScript(RunAdhocScript script) throws RundeckApiException, +2029 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2030 AssertUtil.notBlank(script.getProject(), "project is mandatory to trigger an ad-hoc script !"); +2031 AssertUtil.notNull(script.getScript(), "script is mandatory to trigger an ad-hoc script !"); +2032 ApiPathBuilder apiPath = new ApiPathBuilder("/run/script").param("project", script.getProject()) +2033 .attach("scriptFile", +2034 script.getScript()) +2035 .param("argString",script.getArgString()) +2036 .param("nodeThreadcount", +2037 script.getNodeThreadcount()) +2038 .param("nodeKeepgoing", +2039 script.getNodeKeepgoing()) +2040 .param("scriptInterpreter", +2041 script.getScriptInterpreter()) +2042 .param("interpreterArgsQuoted", +2043 script.getInterpreterArgsQuoted()) +2044 .nodeFilters(script.getNodeFilters()); +2045 if(null!=script.getAsUser()) { +2046 apiPath.param("asUser", script.getAsUser()); +2047 } +2048 RundeckExecution execution = new ApiCall(this).post(apiPath, new ExecutionParser("result/execution")); +2049 // the first call just returns the ID of the execution, so we need another call to get a "real" execution +2050 return getExecution(execution.getId()); +2051 } +2052 +2053 /** +2054 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2055 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2056 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. +2057 * +2058 * @param project name of the project - mandatory +2059 * @param scriptFilename filename of the script to be executed - mandatory +2060 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2061 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2062 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2063 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2064 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2065 * @throws IOException if we failed to read the file +2066 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2067 * @see #triggerAdhocScript(String, String) +2068 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2069 * removed in version 10 of this library +2070 */ +2071 public RundeckExecution runAdhocScript(String project, String scriptFilename) throws RundeckApiException, +2072 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2073 return runAdhocScript(project, scriptFilename, null); +2074 } +2075 +2076 /** +2077 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2078 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2079 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the +2080 * RunDeck server. +2081 * +2082 * @param project name of the project - mandatory +2083 * @param scriptFilename filename of the script to be executed - mandatory +2084 * @param poolingInterval for checking the status of the execution. Must be > 0. +2085 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2086 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2087 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2088 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2089 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2090 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2091 * @throws IOException if we failed to read the file +2092 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2093 * @see #triggerAdhocScript(String, String) +2094 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2095 * removed in version 10 of this library +2096 */ +2097 public RundeckExecution runAdhocScript(String project, String scriptFilename, long poolingInterval, +2098 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2099 IllegalArgumentException, IOException { +2100 return runAdhocScript(project, scriptFilename, null, poolingInterval, poolingUnit); +2101 } +2102 +2103 /** +2104 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2105 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2106 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. +2107 * +2108 * @param project name of the project - mandatory +2109 * @param scriptFilename filename of the script to be executed - mandatory +2110 * @param options of the script - optional. See {@link OptionsBuilder}. +2111 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2112 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2113 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2114 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2115 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2116 * @throws IOException if we failed to read the file +2117 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2118 * @see #triggerAdhocScript(String, String, Properties) +2119 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2120 * removed in version 10 of this library +2121 */ +2122 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options) +2123 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, +2124 IOException { +2125 return runAdhocScript(project, scriptFilename, options, null); +2126 } +2127 +2128 /** +2129 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2130 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2131 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the +2132 * RunDeck server. +2133 * +2134 * @param project name of the project - mandatory +2135 * @param scriptFilename filename of the script to be executed - mandatory +2136 * @param options of the script - optional. See {@link OptionsBuilder}. +2137 * @param poolingInterval for checking the status of the execution. Must be > 0. +2138 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2139 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2140 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2141 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2142 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2143 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2144 * @throws IOException if we failed to read the file +2145 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2146 * @see #triggerAdhocScript(String, String, Properties) +2147 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2148 * removed in version 10 of this library +2149 */ +2150 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, +2151 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, +2152 RundeckApiTokenException, IllegalArgumentException, IOException { +2153 return runAdhocScript(project, scriptFilename, options, null, poolingInterval, poolingUnit); +2154 } +2155 +2156 /** +2157 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2158 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2159 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. +2160 * +2161 * @param project name of the project - mandatory +2162 * @param scriptFilename filename of the script to be executed - mandatory +2163 * @param options of the script - optional. See {@link OptionsBuilder}. +2164 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2165 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2166 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2167 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2168 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2169 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2170 * @throws IOException if we failed to read the file +2171 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2172 * @see #triggerAdhocScript(String, String, Properties, Properties) +2173 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2174 * removed in version 10 of this library +2175 */ +2176 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, +2177 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2178 IllegalArgumentException, IOException { +2179 return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null); +2180 } +2181 +2182 /** +2183 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2184 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2185 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters +2186 * parameter. +2187 * +2188 * @param project name of the project - mandatory +2189 * @param scriptFilename filename of the script to be executed - mandatory +2190 * @param options of the script - optional. See {@link OptionsBuilder}. +2191 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2192 * @param poolingInterval for checking the status of the execution. Must be > 0. +2193 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2194 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2195 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2196 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2197 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2198 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2199 * @throws IOException if we failed to read the file +2200 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2201 * @see #triggerAdhocScript(String, String, Properties, Properties) +2202 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2203 * removed in version 10 of this library +2204 */ +2205 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, +2206 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, +2207 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2208 return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null, poolingInterval, poolingUnit); +2209 } +2210 +2211 /** +2212 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2213 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2214 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. +2215 * +2216 * @param project name of the project - mandatory +2217 * @param scriptFilename filename of the script to be executed - mandatory +2218 * @param options of the script - optional. See {@link OptionsBuilder}. +2219 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2220 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +2221 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +2222 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2223 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2224 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2225 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2226 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2227 * @throws IOException if we failed to read the file +2228 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2229 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +2230 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2231 * removed in version 10 of this library +2232 */ +2233 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, +2234 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, +2235 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2236 return runAdhocScript(project, +2237 scriptFilename, +2238 options, +2239 nodeFilters, +2240 nodeThreadcount, +2241 nodeKeepgoing, +2242 DEFAULT_POOLING_INTERVAL, +2243 DEFAULT_POOLING_UNIT); +2244 } +2245 +2246 /** +2247 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2248 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2249 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters +2250 * parameter. +2251 * +2252 * @param project name of the project - mandatory +2253 * @param scriptFilename filename of the script to be executed - mandatory +2254 * @param options of the script - optional. See {@link OptionsBuilder}. +2255 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2256 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +2257 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +2258 * @param poolingInterval for checking the status of the execution. Must be > 0. +2259 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2260 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2261 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2262 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2263 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2264 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace) +2265 * @throws IOException if we failed to read the file +2266 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2267 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean) +2268 * +2269 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2270 * removed in version 10 of this library +2271 */ +2272 public RundeckExecution runAdhocScript(String project, String scriptFilename, Properties options, +2273 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, +2274 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2275 IllegalArgumentException, IOException { +2276 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to run an ad-hoc script !"); +2277 FileInputStream stream = null; +2278 try { +2279 stream = FileUtils.openInputStream(new File(scriptFilename)); +2280 return runAdhocScript(RunAdhocScriptBuilder.builder() +2281 .setProject(project) +2282 .setScript(stream) +2283 .setNodeFilters(nodeFilters) +2284 .setArgString(ParametersUtil.generateArgString(options)) +2285 .setNodeThreadcount(nodeThreadcount) +2286 .setNodeKeepgoing(nodeKeepgoing) +2287 .build(), +2288 poolingInterval, +2289 poolingUnit); +2290 } finally { +2291 IOUtils.closeQuietly(stream); +2292 } +2293 } +2294 +2295 /** +2296 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2297 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2298 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. +2299 * +2300 * @param project name of the project - mandatory +2301 * @param script inputStream for reading the script to be executed - mandatory +2302 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2303 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2304 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2305 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2306 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2307 * @throws IOException if we failed to read the file +2308 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2309 * @see #triggerAdhocScript(String, InputStream) +2310 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2311 * removed in version 10 of this library +2312 */ +2313 public RundeckExecution runAdhocScript(String project, InputStream script) throws RundeckApiException, +2314 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2315 return runAdhocScript(project, script, null); +2316 } +2317 +2318 /** +2319 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2320 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2321 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the +2322 * RunDeck server. +2323 * +2324 * @param project name of the project - mandatory +2325 * @param script inputStream for reading the script to be executed - mandatory +2326 * @param poolingInterval for checking the status of the execution. Must be > 0. +2327 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2328 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2329 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2330 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2331 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2332 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2333 * @throws IOException if we failed to read the file +2334 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2335 * @see #triggerAdhocScript(String, InputStream) +2336 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2337 * removed in version 10 of this library +2338 */ +2339 public RundeckExecution runAdhocScript(String project, InputStream script, long poolingInterval, +2340 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2341 IllegalArgumentException, IOException { +2342 return runAdhocScript(project, script, null, poolingInterval, poolingUnit); +2343 } +2344 +2345 /** +2346 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2347 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2348 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server. +2349 * +2350 * @param project name of the project - mandatory +2351 * @param script inputStream for reading the script to be executed - mandatory +2352 * @param options of the script - optional. See {@link OptionsBuilder}. +2353 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2354 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2355 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2356 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2357 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2358 * @throws IOException if we failed to read the file +2359 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2360 * @see #triggerAdhocScript(String, InputStream, Properties) +2361 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2362 * removed in version 10 of this library +2363 */ +2364 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options) +2365 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, +2366 IOException { +2367 return runAdhocScript(project, script, options, null); +2368 } +2369 +2370 /** +2371 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2372 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2373 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the +2374 * RunDeck server. +2375 * +2376 * @param project name of the project - mandatory +2377 * @param script inputStream for reading the script to be executed - mandatory +2378 * @param options of the script - optional. See {@link OptionsBuilder}. +2379 * @param poolingInterval for checking the status of the execution. Must be > 0. +2380 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2381 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2382 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2383 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2384 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2385 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2386 * @throws IOException if we failed to read the file +2387 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2388 * @see #triggerAdhocScript(String, InputStream, Properties) +2389 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2390 * removed in version 10 of this library +2391 */ +2392 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, +2393 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, +2394 RundeckApiTokenException, IllegalArgumentException, IOException { +2395 return runAdhocScript(project, script, options, null, poolingInterval, poolingUnit); +2396 } +2397 +2398 /** +2399 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2400 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2401 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. +2402 * +2403 * @param project name of the project - mandatory +2404 * @param script inputStream for reading the script to be executed - mandatory +2405 * @param options of the script - optional. See {@link OptionsBuilder}. +2406 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2407 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2408 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2409 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2410 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2411 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2412 * @throws IOException if we failed to read the file +2413 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2414 * @see #triggerAdhocScript(String, InputStream, Properties, Properties) +2415 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2416 * removed in version 10 of this library +2417 */ +2418 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, +2419 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2420 IllegalArgumentException, IOException { +2421 return runAdhocScript(project, script, options, nodeFilters, null, null); +2422 } +2423 +2424 /** +2425 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2426 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2427 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters +2428 * parameter. +2429 * +2430 * @param project name of the project - mandatory +2431 * @param script inputStream for reading the script to be executed - mandatory +2432 * @param options of the script - optional. See {@link OptionsBuilder}. +2433 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2434 * @param poolingInterval for checking the status of the execution. Must be > 0. +2435 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2436 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2437 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2438 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2439 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2440 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2441 * @throws IOException if we failed to read the file +2442 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2443 * @see #triggerAdhocScript(String, InputStream, Properties, Properties) +2444 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2445 * removed in version 10 of this library +2446 */ +2447 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, +2448 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, +2449 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2450 return runAdhocScript(project, script, options, nodeFilters, null, null, poolingInterval, poolingUnit); +2451 } +2452 +2453 /** +2454 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2455 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2456 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. +2457 * +2458 * @param project name of the project - mandatory +2459 * @param script inputStream for reading the script to be executed - mandatory +2460 * @param options of the script - optional. See {@link OptionsBuilder}. +2461 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2462 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +2463 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +2464 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2465 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2466 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2467 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2468 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2469 * @throws IOException if we failed to read the file +2470 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit) +2471 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +2472 * @deprecated use {@link #runAdhocScript(RunAdhocScript)}, this method will be +2473 * removed in version 10 of this library +2474 */ +2475 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, +2476 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, +2477 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2478 return runAdhocScript(project, +2479 script, +2480 options, +2481 nodeFilters, +2482 nodeThreadcount, +2483 nodeKeepgoing, +2484 DEFAULT_POOLING_INTERVAL, +2485 DEFAULT_POOLING_UNIT); +2486 } +2487 +2488 /** +2489 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2490 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +2491 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter. +2492 * +2493 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} +2494 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2495 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2496 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2497 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2498 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2499 * @throws IOException if we failed to read the file +2500 * @see #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit) +2501 * @see #triggerAdhocScript(RunAdhocScript) +2502 */ +2503 public RundeckExecution runAdhocScript(RunAdhocScript script) throws RundeckApiException, +2504 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { +2505 return runAdhocScript(script, +2506 DEFAULT_POOLING_INTERVAL, +2507 DEFAULT_POOLING_UNIT); +2508 } +2509 +2510 /** +2511 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2512 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2513 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters +2514 * parameter. +2515 * +2516 * @param project name of the project - mandatory +2517 * @param script inputStream for reading the script to be executed - mandatory +2518 * @param options of the script - optional. See {@link OptionsBuilder}. +2519 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2520 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +2521 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +2522 * @param poolingInterval for checking the status of the execution. Must be > 0. +2523 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2524 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2525 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2526 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2527 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2528 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2529 * @throws IOException if we failed to read the file +2530 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2531 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +2532 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2533 * removed in version 10 of this library +2534 */ +2535 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, +2536 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, +2537 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2538 IllegalArgumentException { +2539 return runAdhocScript(project, script, options, nodeFilters, nodeThreadcount, nodeKeepgoing, null, poolingInterval, poolingUnit); +2540 } +2541 +2542 /** +2543 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2544 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2545 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters +2546 * parameter. +2547 * +2548 * @param project name of the project - mandatory +2549 * @param script inputStream for reading the script to be executed - mandatory +2550 * @param options of the script - optional. See {@link OptionsBuilder}. +2551 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder} +2552 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional +2553 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional +2554 * @param poolingInterval for checking the status of the execution. Must be > 0. +2555 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2556 * +2557 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2558 * +2559 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2560 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2561 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2562 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2563 * @throws IOException if we failed to read the file +2564 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2565 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +2566 * @deprecated use {@link #runAdhocScript(RunAdhocScript, long, java.util.concurrent.TimeUnit)}, this method will be +2567 * removed in version 10 of this library +2568 */ +2569 public RundeckExecution runAdhocScript(String project, InputStream script, Properties options, +2570 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, String asUser, long poolingInterval, +2571 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2572 IllegalArgumentException { +2573 return runAdhocScript(RunAdhocScriptBuilder.builder() +2574 .setProject(project) +2575 .setScript(script) +2576 .setNodeFilters(nodeFilters) +2577 .setArgString(ParametersUtil.generateArgString(options)) +2578 .setNodeThreadcount(nodeThreadcount) +2579 .setNodeKeepgoing(nodeKeepgoing) +2580 .setAsUser(asUser) +2581 .build(), poolingInterval, poolingUnit); +2582 } +2583 +2584 /** +2585 * Run an ad-hoc script read from a file, and wait until its execution is finished (or aborted) to return. We will +2586 * poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the +2587 * execution is finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to +2588 * the nodeFilters parameter. 2589 * -2590 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2591 * -2592 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2593 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2594 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2595 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2596 * @throws IOException if we failed to read the file -2597 * @see #runAdhocScript(RunAdhocScript) -2598 * @see #triggerAdhocScript(RunAdhocScript, String) -2599 */ -2600 public RundeckExecution runAdhocScript(final RunAdhocScript script, final String scriptFilename, -2601 final long poolingInterval, final TimeUnit poolingUnit) throws RundeckApiException, -2602 RundeckApiLoginException, RundeckApiTokenException, -2603 IllegalArgumentException, IOException { -2604 FileInputStream stream = null; -2605 try { -2606 stream = FileUtils.openInputStream(new File(scriptFilename)); -2607 return runAdhocScript(RunAdhocScriptBuilder.builder(script) -2608 .setScript(stream) -2609 .build(), poolingInterval, poolingUnit); -2610 } finally { -2611 IOUtils.closeQuietly(stream); -2612 } -2613 } -2614 /** -2615 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -2616 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -2617 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters -2618 * parameter. -2619 * -2620 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} -2621 * @param poolingInterval for checking the status of the execution. Must be > 0. -2622 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -2623 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -2624 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2625 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2626 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2627 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null -2628 * @throws IOException if we failed to read the file -2629 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) -2630 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) -2631 */ -2632 public RundeckExecution runAdhocScript(final RunAdhocScript script, long poolingInterval, -2633 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, -2634 IllegalArgumentException { -2635 if (poolingInterval <= 0) { -2636 poolingInterval = DEFAULT_POOLING_INTERVAL; -2637 poolingUnit = DEFAULT_POOLING_UNIT; -2638 } -2639 if (poolingUnit == null) { -2640 poolingUnit = DEFAULT_POOLING_UNIT; -2641 } -2642 -2643 RundeckExecution execution = triggerAdhocScript(script); -2644 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { -2645 try { -2646 Thread.sleep(poolingUnit.toMillis(poolingInterval)); -2647 } catch (InterruptedException e) { -2648 break; -2649 } -2650 execution = getExecution(execution.getId()); -2651 } -2652 return execution; -2653 } -2654 -2655 /* -2656 * Executions -2657 */ -2658 -2659 /** -2660 * Get all running executions (for all projects) -2661 * -2662 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2663 * @throws RundeckApiException in case of error when calling the API -2664 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2665 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2666 * @see #getRunningExecutions(String) -2667 */ -2668 public List<RundeckExecution> getRunningExecutions() throws RundeckApiException, RundeckApiLoginException, -2669 RundeckApiTokenException { -2670 List<RundeckExecution> executions = new ArrayList<RundeckExecution>(); -2671 for (RundeckProject project : getProjects()) { -2672 executions.addAll(getRunningExecutions(project.getName())); -2673 } -2674 return executions; -2675 } -2676 -2677 /** -2678 * Get the running executions for the given project -2679 * -2680 * @param project name of the project - mandatory -2681 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2682 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2683 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2684 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2685 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2686 * @see #getRunningExecutions() -2687 */ -2688 public List<RundeckExecution> getRunningExecutions(String project) throws RundeckApiException, -2689 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2690 AssertUtil.notBlank(project, "project is mandatory get all running executions !"); -2691 return new ApiCall(this).get(new ApiPathBuilder("/executions/running").param("project", project), -2692 new ListParser<RundeckExecution>(new ExecutionParser(), -2693 "result/executions/execution")); -2694 } -2695 -2696 /** -2697 * Get the executions of the given job -2698 * -2699 * @param jobId identifier of the job - mandatory -2700 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2701 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -2702 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2703 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2704 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -2705 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) -2706 */ -2707 public List<RundeckExecution> getJobExecutions(String jobId) throws RundeckApiException, RundeckApiLoginException, -2708 RundeckApiTokenException, IllegalArgumentException { -2709 return getJobExecutions(jobId, (ExecutionStatus) null); -2710 } -2711 -2712 /** -2713 * Get the executions of the given job -2714 * -2715 * @param jobId identifier of the job - mandatory -2716 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) -2717 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2718 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -2719 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2720 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2721 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is -2722 * invalid -2723 * @see #getJobExecutions(String, String, Long, Long) -2724 */ -2725 public List<RundeckExecution> getJobExecutions(String jobId, String status) throws RundeckApiException, -2726 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2727 return getJobExecutions(jobId, -2728 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status))); -2729 } -2730 -2731 /** -2732 * Get the executions of the given job -2733 * -2734 * @param jobId identifier of the job - mandatory -2735 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) -2736 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2737 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -2738 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2739 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2740 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -2741 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) -2742 */ -2743 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status) throws RundeckApiException, -2744 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2745 return getJobExecutions(jobId, status, null, null); -2746 } -2747 -2748 /** -2749 * Get the executions of the given job -2750 * -2751 * @param jobId identifier of the job - mandatory -2752 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) -2753 * @param max number of results to return - optional (null for all) -2754 * @param offset the 0-indexed offset for the first result to return - optional -2755 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2756 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -2757 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2758 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2759 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is -2760 * invalid -2761 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) -2762 */ -2763 public List<RundeckExecution> getJobExecutions(String jobId, String status, Long max, Long offset) -2764 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2765 return getJobExecutions(jobId, -2766 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)), -2767 max, -2768 offset); -2769 } -2770 -2771 /** -2772 * Get the executions of the given job -2773 * -2774 * @param jobId identifier of the job - mandatory -2775 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) -2776 * @param max number of results to return - optional (null for all) -2777 * @param offset the 0-indexed offset for the first result to return - optional -2778 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2779 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -2780 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2781 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2782 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -2783 */ -2784 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status, Long max, Long offset) -2785 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2786 AssertUtil.notBlank(jobId, "jobId is mandatory to get the executions of a job !"); -2787 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId, "/executions").param("status", status) -2788 .param("max", max) -2789 .param("offset", offset), -2790 new ListParser<RundeckExecution>(new ExecutionParser(), -2791 "result/executions/execution")); -2792 } -2793 -2794 /** -2795 * Get executions based on query parameters -2796 * -2797 * @param query query parameters for the request -2798 * @param max number of results to return - optional (null for all) -2799 * @param offset the 0-indexed offset for the first result to return - optional -2800 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -2801 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -2802 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2803 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2804 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -2805 */ -2806 public PagedResults<RundeckExecution> getExecutions(ExecutionQuery query, Long max, Long offset) -2807 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2808 if (!query.notBlank()) { -2809 throw new IllegalArgumentException("Some execution query parameter must be set"); -2810 } -2811 AssertUtil.notBlank(query.getProject(), "project is required for execution query"); -2812 return new ApiCall(this).get(new ApiPathBuilder("/executions") -2813 .param(new ExecutionQueryParameters(query)) -2814 .param("max", max) -2815 .param("offset", offset), -2816 new PagedResultParser<RundeckExecution>( -2817 new ListParser<RundeckExecution>(new ExecutionParser(), "execution"), -2818 "result/executions" -2819 ) -2820 ); -2821 } -2822 -2823 /** -2824 * Get a single execution, identified by the given ID -2825 * -2826 * @param executionId identifier of the execution - mandatory -2827 * @return a {@link RundeckExecution} instance - won't be null -2828 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) -2829 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2830 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2831 * @throws IllegalArgumentException if the executionId is null -2832 */ -2833 public RundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, -2834 RundeckApiTokenException, IllegalArgumentException { -2835 AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !"); -2836 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString()), -2837 new ExecutionParser("result/executions/execution")); -2838 } -2839 -2840 /** -2841 * Abort an execution (identified by the given ID). The execution should be running... -2842 * -2843 * @param executionId identifier of the execution - mandatory -2844 * @return a {@link RundeckAbort} instance - won't be null -2845 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) -2846 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2847 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2848 * @throws IllegalArgumentException if the executionId is null -2849 */ -2850 public RundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, -2851 RundeckApiTokenException, IllegalArgumentException { -2852 return abortExecution(executionId, null); -2853 } -2854 /** -2855 * Abort an execution (identified by the given ID). The execution should be running... -2856 * -2857 * @param executionId identifier of the execution - mandatory -2858 * @param asUser specify a user name to abort the job as, must have 'killAs' permission -2859 * @return a {@link RundeckAbort} instance - won't be null -2860 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) -2861 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2862 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2863 * @throws IllegalArgumentException if the executionId is null -2864 */ -2865 public RundeckAbort abortExecution(Long executionId, final String asUser) throws RundeckApiException, RundeckApiLoginException, -2866 RundeckApiTokenException, IllegalArgumentException { -2867 AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !"); -2868 ApiPathBuilder apiPath = new ApiPathBuilder("/execution/", executionId.toString(), "/abort"); -2869 if(null!=asUser) { -2870 apiPath.param("asUser", asUser); -2871 } -2872 return new ApiCall(this).get(apiPath, new AbortParser("result/abort")); -2873 } -2874 -2875 /* -2876 * History -2877 */ -2878 -2879 /** -2880 * Get the (events) history for the given project -2881 * -2882 * @param project name of the project - mandatory -2883 * @return a {@link RundeckHistory} instance - won't be null -2884 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2885 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2886 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2887 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2888 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -2889 */ -2890 public RundeckHistory getHistory(String project) throws RundeckApiException, RundeckApiLoginException, -2891 RundeckApiTokenException, IllegalArgumentException { -2892 return getHistory(project, null, null,(String) null, (String) null, null, null, null, null); -2893 } -2894 -2895 /** -2896 * Get the (events) history for the given project -2897 * -2898 * @param project name of the project - mandatory -2899 * @param max number of results to return - optional (default to 20) -2900 * @param offset the 0-indexed offset for the first result to return - optional (default to O) -2901 * @return a {@link RundeckHistory} instance - won't be null -2902 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2903 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2904 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2905 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2906 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -2907 */ -2908 public RundeckHistory getHistory(String project, Long max, Long offset) throws RundeckApiException, -2909 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2910 return getHistory(project, null, null, (String)null, (String)null, null, null, max, offset); -2911 } -2912 -2913 /** -2914 * Get the (events) history for the given project -2915 * -2916 * @param project name of the project - mandatory -2917 * @param jobId include only events matching the given job ID - optional -2918 * @param reportId include only events matching the given report ID - optional -2919 * @param user include only events created by the given user - optional -2920 * @return a {@link RundeckHistory} instance - won't be null -2921 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2922 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2923 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2924 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2925 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -2926 */ -2927 public RundeckHistory getHistory(String project, String jobId, String reportId, String user) -2928 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2929 return getHistory(project, jobId, reportId, user, null, null, null, null, null); -2930 } -2931 -2932 /** -2933 * Get the (events) history for the given project -2934 * -2935 * @param project name of the project - mandatory -2936 * @param jobId include only events matching the given job ID - optional -2937 * @param reportId include only events matching the given report ID - optional -2938 * @param user include only events created by the given user - optional -2939 * @param max number of results to return - optional (default to 20) -2940 * @param offset the 0-indexed offset for the first result to return - optional (default to O) -2941 * @return a {@link RundeckHistory} instance - won't be null -2942 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2943 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2944 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2945 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2946 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -2947 */ -2948 public RundeckHistory getHistory(String project, String jobId, String reportId, String user, Long max, Long offset) -2949 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2950 return getHistory(project, jobId, reportId, user, null, null, null, max, offset); -2951 } -2952 -2953 /** -2954 * Get the (events) history for the given project -2955 * -2956 * @param project name of the project - mandatory -2957 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y -2958 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2 -2959 * weeks), "5d" (= last 5 days), etc. Optional. -2960 * @return a {@link RundeckHistory} instance - won't be null -2961 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2962 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2963 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2964 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2965 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -2966 */ -2967 public RundeckHistory getHistory(String project, String recent) throws RundeckApiException, -2968 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2969 return getHistory(project, null, null, null, recent, null, null, null, null); -2970 } -2971 -2972 /** -2973 * Get the (events) history for the given project -2974 * -2975 * @param project name of the project - mandatory -2976 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y -2977 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2 -2978 * weeks), "5d" (= last 5 days), etc. Optional. -2979 * @param max number of results to return - optional (default to 20) -2980 * @param offset the 0-indexed offset for the first result to return - optional (default to O) -2981 * @return a {@link RundeckHistory} instance - won't be null -2982 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -2983 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -2984 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -2985 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -2986 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -2987 */ -2988 public RundeckHistory getHistory(String project, String recent, Long max, Long offset) throws RundeckApiException, -2989 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -2990 return getHistory(project, null, null, null, recent, null, null, max, offset); -2991 } -2992 -2993 /** -2994 * Get the (events) history for the given project -2995 * -2996 * @param project name of the project - mandatory -2997 * @param begin date for the earlier events to retrieve - optional -2998 * @param end date for the latest events to retrieve - optional -2999 * @return a {@link RundeckHistory} instance - won't be null -3000 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -3001 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3002 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3003 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -3004 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -3005 */ -3006 public RundeckHistory getHistory(String project, Date begin, Date end) throws RundeckApiException, -3007 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -3008 return getHistory(project, null, null, (String)null, (String)null, begin, end, null, null); -3009 } -3010 -3011 /** -3012 * Get the (events) history for the given project -3013 * -3014 * @param project name of the project - mandatory -3015 * @param begin date for the earlier events to retrieve - optional -3016 * @param end date for the latest events to retrieve - optional -3017 * @param max number of results to return - optional (default to 20) -3018 * @param offset the 0-indexed offset for the first result to return - optional (default to O) -3019 * @return a {@link RundeckHistory} instance - won't be null -3020 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -3021 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3022 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3023 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -3024 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) -3025 */ -3026 public RundeckHistory getHistory(String project, Date begin, Date end, Long max, Long offset) -3027 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -3028 return getHistory(project, null, null, (String)null, (String) null, begin, end, max, offset); -3029 } -3030 -3031 /** -3032 * Get the (events) history for the given project -3033 * -3034 * @param project name of the project - mandatory -3035 * @param jobId include only events matching the given job ID - optional -3036 * @param reportId include only events matching the given report ID - optional -3037 * @param user include only events created by the given user - optional -3038 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y -3039 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2 -3040 * weeks), "5d" (= last 5 days), etc. Optional. -3041 * @param begin date for the earlier events to retrieve - optional -3042 * @param end date for the latest events to retrieve - optional -3043 * @param max number of results to return - optional (default to 20) -3044 * @param offset the 0-indexed offset for the first result to return - optional (default to O) -3045 * @return a {@link RundeckHistory} instance - won't be null -3046 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -3047 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3048 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3049 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -3050 */ -3051 public RundeckHistory getHistory(String project, String jobId, String reportId, String user, String recent, -3052 Date begin, Date end, Long max, Long offset) throws RundeckApiException, RundeckApiLoginException, -3053 RundeckApiTokenException, IllegalArgumentException { -3054 AssertUtil.notBlank(project, "project is mandatory to get the history !"); -3055 return new ApiCall(this).get(new ApiPathBuilder("/history").param("project", project) -3056 .param("jobIdFilter", jobId) -3057 .param("reportIdFilter", reportId) -3058 .param("userFilter", user) -3059 .param("recentFilter", recent) -3060 .param("begin", begin) -3061 .param("end", end) -3062 .param("max", max) -3063 .param("offset", offset), -3064 new HistoryParser("result/events")); -3065 } -3066 -3067 /** -3068 * Get the (events) history for the given project -3069 * -3070 * @param project name of the project - mandatory -3071 * @param includeJobNames list of job names ("group/name") to include results for -3072 * @param excludeJobNames list of job names ("group/name") to exclude results for -3073 * @param user include only events created by the given user - optional -3074 * @param recent include only events matching the given period of time. Format : "XY", where X is an -3075 * integer, and Y is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). -3076 * Example : "2w" (= last 2 weeks), "5d" (= last 5 days), etc. Optional. -3077 * @param begin date for the earlier events to retrieve - optional -3078 * @param end date for the latest events to retrieve - optional -3079 * @param max number of results to return - optional (default to 20) -3080 * @param offset the 0-indexed offset for the first result to return - optional (default to O) -3081 * -3082 * @return a {@link RundeckHistory} instance - won't be null -3083 * -3084 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -3085 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3086 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3087 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -3088 */ -3089 public RundeckHistory getHistory(String project, -3090 String user, -3091 String recent, -3092 List<String> includeJobNames, -3093 List<String> excludeJobNames, -3094 Date begin, -3095 Date end, -3096 Long max, -3097 Long offset) -3098 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -3099 -3100 AssertUtil.notBlank(project, "project is mandatory to get the history !"); -3101 final ApiPathBuilder builder = new ApiPathBuilder("/history").param("project", project) -3102 .field("jobListFilter", includeJobNames) -3103 .field("excludeJobListFilter", excludeJobNames) -3104 .param("userFilter", user) -3105 .param("recentFilter", recent) -3106 .param("begin", begin) -3107 .param("end", end) -3108 .param("max", max) -3109 .param("offset", offset); -3110 -3111 return new ApiCall(this).postOrGet(builder, new HistoryParser("result/events")); -3112 } -3113 -3114 /* -3115 * Nodes -3116 */ -3117 -3118 /** -3119 * List all nodes (for all projects) -3120 * -3121 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null -3122 * @throws RundeckApiException in case of error when calling the API -3123 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3124 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3125 */ -3126 public List<RundeckNode> getNodes() throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException { -3127 List<RundeckNode> nodes = new ArrayList<RundeckNode>(); -3128 for (RundeckProject project : getProjects()) { -3129 nodes.addAll(getNodes(project.getName())); -3130 } -3131 return nodes; -3132 } -3133 -3134 /** -3135 * List all nodes that belongs to the given project -3136 * -3137 * @param project name of the project - mandatory -3138 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null -3139 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -3140 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3141 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3142 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -3143 * @see #getNodes(String, Properties) -3144 */ -3145 public List<RundeckNode> getNodes(String project) throws RundeckApiException, RundeckApiLoginException, -3146 RundeckApiTokenException, IllegalArgumentException { -3147 return getNodes(project, null); -3148 } -3149 -3150 /** -3151 * List nodes that belongs to the given project -3152 * -3153 * @param project name of the project - mandatory -3154 * @param nodeFilters for filtering the nodes - optional. See {@link NodeFiltersBuilder} -3155 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null -3156 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -3157 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3158 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3159 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -3160 */ -3161 public List<RundeckNode> getNodes(String project, Properties nodeFilters) throws RundeckApiException, -3162 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -3163 AssertUtil.notBlank(project, "project is mandatory to get all nodes !"); -3164 return new ApiCall(this).get(new ApiPathBuilder("/resources").param("project", project) -3165 .nodeFilters(nodeFilters), -3166 new ListParser<RundeckNode>(new NodeParser(), "project/node")); -3167 } -3168 -3169 /** -3170 * Get the definition of a single node -3171 * -3172 * @param name of the node - mandatory -3173 * @param project name of the project - mandatory -3174 * @return a {@link RundeckNode} instance - won't be null -3175 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) -3176 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3177 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3178 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) -3179 */ -3180 public RundeckNode getNode(String name, String project) throws RundeckApiException, RundeckApiLoginException, -3181 RundeckApiTokenException, IllegalArgumentException { -3182 AssertUtil.notBlank(name, "the name of the node is mandatory to get a node !"); -3183 AssertUtil.notBlank(project, "project is mandatory to get a node !"); -3184 return new ApiCall(this).get(new ApiPathBuilder("/resource/", name).param("project", project), -3185 new NodeParser("project/node")); -3186 } -3187 -3188 /** -3189 * Get the output of a job execution -3190 * -3191 * @param executionId id of the execution - mandatory -3192 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -3193 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) -3194 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3195 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3196 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) -3197 */ -3198 public InputStream getOutput(String executionId) throws RundeckApiException, RundeckApiLoginException, -3199 RundeckApiTokenException, IllegalArgumentException { -3200 AssertUtil.notBlank(executionId, "the execution id is mandatory to get execution output !"); -3201 return new ApiCall(this).getNonApi(new ApiPathBuilder("/execution/downloadOutput/", executionId)); -3202 } -3203 -3204 /** -3205 * Get the html page of the user's profile -3206 * -3207 * @param username - mandatory -3208 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -3209 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) -3210 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3211 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3212 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) -3213 */ -3214 public InputStream getProfilePage(String username) throws RundeckApiException, RundeckApiLoginException, -3215 RundeckApiTokenException, IllegalArgumentException { -3216 AssertUtil.notBlank(username, "the username is mandatory to get profile page !"); -3217 return new ApiCall(this).getNonApi(new ApiPathBuilder("/user/profile?login=", username)); -3218 } -3219 -3220 -3221 /** -3222 * Generate a new token and get the result page (which is the html page of the user's profile) -3223 * -3224 * @param username - mandatory -3225 * @return an {@link InputStream} instance, not linked to any network resources - won't be null -3226 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) -3227 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3228 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3229 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) -3230 */ -3231 public InputStream generateToken(String username) throws RundeckApiException, RundeckApiLoginException, -3232 RundeckApiTokenException, IllegalArgumentException { -3233 AssertUtil.notBlank(username, "the username is mandatory to generate the token"); -3234 return new ApiCall(this).getNonApi(new ApiPathBuilder("/user/generateApiToken?login=", username)); -3235 } -3236 -3237 -3238 /** -3239 * Get the execution output of the given job -3240 * -3241 * @param executionId identifier of the execution - mandatory -3242 * @param offset byte offset to read from in the file. 0 indicates the beginning. -3243 * @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. -3244 * @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 -3245 * @param maxlines maximum number of lines to retrieve forward from the specified offset. -3246 * @return {@link RundeckOutput} -3247 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -3248 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3249 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3250 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -3251 */ -3252 public RundeckOutput getJobExecutionOutput(Long executionId, int offset, int lastlines, long lastmod, int maxlines) -3253 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -3254 AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); -3255 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output.xml").param("offset", offset) -3256 .param("lastlines", lastlines) -3257 .param("lastmod", lastmod) -3258 .param("maxlines", maxlines), -3259 new OutputParser("result/output", createOutputEntryParser())); -3260 } -3261 -3262 -3263 /** -3264 * Get the execution output of the given job -3265 * -3266 * @param executionId identifier of the execution - mandatory -3267 * @param offset byte offset to read from in the file. 0 indicates the beginning. -3268 * @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 -3269 * @param maxlines maximum number of lines to retrieve forward from the specified offset. -3270 * @return {@link RundeckOutput} -3271 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -3272 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3273 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3274 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -3275 */ -3276 public RundeckOutput getJobExecutionOutput(Long executionId, int offset, long lastmod, int maxlines) -3277 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { -3278 AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); -3279 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output.xml").param("offset", offset) -3280 .param("lastmod", lastmod) -3281 .param("maxlines", maxlines), -3282 new OutputParser("result/output", createOutputEntryParser())); -3283 } -3284 -3285 private OutputEntryParser createOutputEntryParser() { -3286 if (getApiVersion() <= Version.V5.versionNumber) { -3287 return new OutputEntryParserV5(); -3288 }else{ -3289 return new OutputEntryParser(); -3290 } -3291 } -3292 -3293 -3294 /* -3295 * System Info -3296 */ -3297 -3298 /** -3299 * Get system informations about the RunDeck server -3300 * -3301 * @return a {@link RundeckSystemInfo} instance - won't be null -3302 * @throws RundeckApiException in case of error when calling the API -3303 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) -3304 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) -3305 */ -3306 public RundeckSystemInfo getSystemInfo() throws RundeckApiException, RundeckApiLoginException, -3307 RundeckApiTokenException { -3308 return new ApiCall(this).get(new ApiPathBuilder("/system/info"), new SystemInfoParser("result/system")); -3309 } -3310 -3311 /** -3312 * @return the URL of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) -3313 */ -3314 public String getUrl() { -3315 return url; -3316 } -3317 -3318 /** -3319 * @return the auth-token used for authentication on the RunDeck instance (null if using login-based or session-based auth) -3320 */ -3321 public String getToken() { -3322 return token; -3323 } -3324 -3325 /** -3326 * @return the login used for authentication on the RunDeck instance (null if using token-based or session-based auth) -3327 */ -3328 public String getLogin() { -3329 return login; -3330 } -3331 -3332 /** -3333 * @return the password used for authentication on the RunDeck instance (null if using token-based or session-based auth) -3334 */ -3335 public String getPassword() { -3336 return password; -3337 } -3338 -3339 /** -3340 * @return the sessionID used for authentication on the RunDeck instance (null if using login-based or token-based auth) -3341 */ -3342 public String getSessionID() { -3343 return sessionID; -3344 } -3345 -3346 @Override -3347 public String toString() { -3348 StringBuilder str = new StringBuilder(); -3349 str.append("RundeckClient ").append(API_VERSION); -3350 str.append(" [").append(url).append("] "); -3351 if (token != null) { -3352 str.append("(token=").append(token).append(")"); -3353 } else { -3354 str.append("(credentials=").append(login).append("|").append(password).append(")"); -3355 } -3356 return str.toString(); -3357 } -3358 -3359 @Override -3360 public int hashCode() { -3361 final int prime = 31; -3362 int result = 1; -3363 result = prime * result + ((login == null) ? 0 : login.hashCode()); -3364 result = prime * result + ((password == null) ? 0 : password.hashCode()); -3365 result = prime * result + ((token == null) ? 0 : token.hashCode()); -3366 result = prime * result + ((url == null) ? 0 : url.hashCode()); -3367 return result; -3368 } -3369 -3370 @Override -3371 public boolean equals(Object obj) { -3372 if (this == obj) -3373 return true; -3374 if (obj == null) -3375 return false; -3376 if (getClass() != obj.getClass()) -3377 return false; -3378 RundeckClient other = (RundeckClient) obj; -3379 if (login == null) { -3380 if (other.login != null) -3381 return false; -3382 } else if (!login.equals(other.login)) -3383 return false; -3384 if (password == null) { -3385 if (other.password != null) -3386 return false; -3387 } else if (!password.equals(other.password)) -3388 return false; -3389 if (token == null) { -3390 if (other.token != null) +2590 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} +2591 * @param scriptFilename filename of a script to read +2592 * @param poolingInterval for checking the status of the execution. Must be > 0. +2593 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2594 * +2595 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2596 * +2597 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2598 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2599 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2600 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2601 * @throws IOException if we failed to read the file +2602 * @see #runAdhocScript(RunAdhocScript) +2603 * @see #triggerAdhocScript(RunAdhocScript, String) +2604 */ +2605 public RundeckExecution runAdhocScript(final RunAdhocScript script, final String scriptFilename, +2606 final long poolingInterval, final TimeUnit poolingUnit) throws RundeckApiException, +2607 RundeckApiLoginException, RundeckApiTokenException, +2608 IllegalArgumentException, IOException { +2609 FileInputStream stream = null; +2610 try { +2611 stream = FileUtils.openInputStream(new File(scriptFilename)); +2612 return runAdhocScript(RunAdhocScriptBuilder.builder(script) +2613 .setScript(stream) +2614 .build(), poolingInterval, poolingUnit); +2615 } finally { +2616 IOUtils.closeQuietly(stream); +2617 } +2618 } +2619 /** +2620 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +2621 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +2622 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters +2623 * parameter. +2624 * +2625 * @param script the RunAdhocScript, see {@link RunAdhocScriptBuilder} +2626 * @param poolingInterval for checking the status of the execution. Must be > 0. +2627 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +2628 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +2629 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2630 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2631 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2632 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null +2633 * @throws IOException if we failed to read the file +2634 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit) +2635 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean) +2636 */ +2637 public RundeckExecution runAdhocScript(final RunAdhocScript script, long poolingInterval, +2638 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, +2639 IllegalArgumentException { +2640 if (poolingInterval <= 0) { +2641 poolingInterval = DEFAULT_POOLING_INTERVAL; +2642 poolingUnit = DEFAULT_POOLING_UNIT; +2643 } +2644 if (poolingUnit == null) { +2645 poolingUnit = DEFAULT_POOLING_UNIT; +2646 } +2647 +2648 RundeckExecution execution = triggerAdhocScript(script); +2649 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { +2650 try { +2651 Thread.sleep(poolingUnit.toMillis(poolingInterval)); +2652 } catch (InterruptedException e) { +2653 break; +2654 } +2655 execution = getExecution(execution.getId()); +2656 } +2657 return execution; +2658 } +2659 +2660 /* +2661 * Executions +2662 */ +2663 +2664 /** +2665 * Get all running executions (for all projects) +2666 * +2667 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2668 * @throws RundeckApiException in case of error when calling the API +2669 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2670 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2671 * @see #getRunningExecutions(String) +2672 */ +2673 public List<RundeckExecution> getRunningExecutions() throws RundeckApiException, RundeckApiLoginException, +2674 RundeckApiTokenException { +2675 if (this.getApiVersion() >= Version.V9.getVersionNumber()) { +2676 //simply query using '*' +2677 return getRunningExecutions("*"); +2678 } else { +2679 List<RundeckExecution> executions = new ArrayList<RundeckExecution>(); +2680 for (RundeckProject project : getProjects()) { +2681 executions.addAll(getRunningExecutions(project.getName())); +2682 } +2683 return executions; +2684 } +2685 } +2686 +2687 /** +2688 * Get the running executions for the given project +2689 * +2690 * @param project name of the project - mandatory +2691 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2692 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2693 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2694 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2695 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2696 * @see #getRunningExecutions() +2697 */ +2698 public List<RundeckExecution> getRunningExecutions(String project) throws RundeckApiException, +2699 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2700 AssertUtil.notBlank(project, "project is mandatory get all running executions !"); +2701 return new ApiCall(this).get(new ApiPathBuilder("/executions/running").param("project", project), +2702 new ListParser<RundeckExecution>(new ExecutionParser(), +2703 "result/executions/execution")); +2704 } +2705 +2706 /** +2707 * Get the executions of the given job +2708 * +2709 * @param jobId identifier of the job - mandatory +2710 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2711 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +2712 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2713 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2714 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +2715 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) +2716 */ +2717 public List<RundeckExecution> getJobExecutions(String jobId) throws RundeckApiException, RundeckApiLoginException, +2718 RundeckApiTokenException, IllegalArgumentException { +2719 return getJobExecutions(jobId, (ExecutionStatus) null); +2720 } +2721 +2722 /** +2723 * Get the executions of the given job +2724 * +2725 * @param jobId identifier of the job - mandatory +2726 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) +2727 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2728 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +2729 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2730 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2731 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is +2732 * invalid +2733 * @see #getJobExecutions(String, String, Long, Long) +2734 */ +2735 public List<RundeckExecution> getJobExecutions(String jobId, String status) throws RundeckApiException, +2736 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2737 return getJobExecutions(jobId, +2738 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status))); +2739 } +2740 +2741 /** +2742 * Get the executions of the given job +2743 * +2744 * @param jobId identifier of the job - mandatory +2745 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) +2746 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2747 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +2748 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2749 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2750 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +2751 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) +2752 */ +2753 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status) throws RundeckApiException, +2754 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2755 return getJobExecutions(jobId, status, null, null); +2756 } +2757 +2758 /** +2759 * Get the executions of the given job +2760 * +2761 * @param jobId identifier of the job - mandatory +2762 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) +2763 * @param max number of results to return - optional (null for all) +2764 * @param offset the 0-indexed offset for the first result to return - optional +2765 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2766 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +2767 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2768 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2769 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is +2770 * invalid +2771 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) +2772 */ +2773 public List<RundeckExecution> getJobExecutions(String jobId, String status, Long max, Long offset) +2774 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2775 return getJobExecutions(jobId, +2776 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)), +2777 max, +2778 offset); +2779 } +2780 +2781 /** +2782 * Get the executions of the given job +2783 * +2784 * @param jobId identifier of the job - mandatory +2785 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) +2786 * @param max number of results to return - optional (null for all) +2787 * @param offset the 0-indexed offset for the first result to return - optional +2788 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2789 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +2790 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2791 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2792 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +2793 */ +2794 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status, Long max, Long offset) +2795 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2796 AssertUtil.notBlank(jobId, "jobId is mandatory to get the executions of a job !"); +2797 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId, "/executions").param("status", status) +2798 .param("max", max) +2799 .param("offset", offset), +2800 new ListParser<RundeckExecution>(new ExecutionParser(), +2801 "result/executions/execution")); +2802 } +2803 +2804 /** +2805 * Get executions based on query parameters +2806 * +2807 * @param query query parameters for the request +2808 * @param max number of results to return - optional (null for all) +2809 * @param offset the 0-indexed offset for the first result to return - optional +2810 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +2811 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +2812 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2813 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2814 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +2815 */ +2816 public PagedResults<RundeckExecution> getExecutions(ExecutionQuery query, Long max, Long offset) +2817 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2818 if (!query.notBlank()) { +2819 throw new IllegalArgumentException("Some execution query parameter must be set"); +2820 } +2821 AssertUtil.notBlank(query.getProject(), "project is required for execution query"); +2822 return new ApiCall(this).get(new ApiPathBuilder("/executions") +2823 .param(new ExecutionQueryParameters(query)) +2824 .param("max", max) +2825 .param("offset", offset), +2826 new PagedResultParser<RundeckExecution>( +2827 new ListParser<RundeckExecution>(new ExecutionParser(), "execution"), +2828 "result/executions" +2829 ) +2830 ); +2831 } +2832 +2833 /** +2834 * Get a single execution, identified by the given ID +2835 * +2836 * @param executionId identifier of the execution - mandatory +2837 * @return a {@link RundeckExecution} instance - won't be null +2838 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) +2839 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2840 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2841 * @throws IllegalArgumentException if the executionId is null +2842 */ +2843 public RundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, +2844 RundeckApiTokenException, IllegalArgumentException { +2845 AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !"); +2846 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString()), +2847 new ExecutionParser("result/executions/execution")); +2848 } +2849 +2850 /** +2851 * Abort an execution (identified by the given ID). The execution should be running... +2852 * +2853 * @param executionId identifier of the execution - mandatory +2854 * @return a {@link RundeckAbort} instance - won't be null +2855 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) +2856 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2857 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2858 * @throws IllegalArgumentException if the executionId is null +2859 */ +2860 public RundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, +2861 RundeckApiTokenException, IllegalArgumentException { +2862 return abortExecution(executionId, null); +2863 } +2864 /** +2865 * Abort an execution (identified by the given ID). The execution should be running... +2866 * +2867 * @param executionId identifier of the execution - mandatory +2868 * @param asUser specify a user name to abort the job as, must have 'killAs' permission +2869 * @return a {@link RundeckAbort} instance - won't be null +2870 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) +2871 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2872 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2873 * @throws IllegalArgumentException if the executionId is null +2874 */ +2875 public RundeckAbort abortExecution(Long executionId, final String asUser) throws RundeckApiException, RundeckApiLoginException, +2876 RundeckApiTokenException, IllegalArgumentException { +2877 AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !"); +2878 ApiPathBuilder apiPath = new ApiPathBuilder("/execution/", executionId.toString(), "/abort"); +2879 if(null!=asUser) { +2880 apiPath.param("asUser", asUser); +2881 } +2882 return new ApiCall(this).get(apiPath, new AbortParser("result/abort")); +2883 } +2884 +2885 /* +2886 * History +2887 */ +2888 +2889 /** +2890 * Get the (events) history for the given project +2891 * +2892 * @param project name of the project - mandatory +2893 * @return a {@link RundeckHistory} instance - won't be null +2894 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2895 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2896 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2897 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2898 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +2899 */ +2900 public RundeckHistory getHistory(String project) throws RundeckApiException, RundeckApiLoginException, +2901 RundeckApiTokenException, IllegalArgumentException { +2902 return getHistory(project, null, null,(String) null, (String) null, null, null, null, null); +2903 } +2904 +2905 /** +2906 * Get the (events) history for the given project +2907 * +2908 * @param project name of the project - mandatory +2909 * @param max number of results to return - optional (default to 20) +2910 * @param offset the 0-indexed offset for the first result to return - optional (default to O) +2911 * @return a {@link RundeckHistory} instance - won't be null +2912 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2913 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2914 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2915 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2916 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +2917 */ +2918 public RundeckHistory getHistory(String project, Long max, Long offset) throws RundeckApiException, +2919 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2920 return getHistory(project, null, null, (String)null, (String)null, null, null, max, offset); +2921 } +2922 +2923 /** +2924 * Get the (events) history for the given project +2925 * +2926 * @param project name of the project - mandatory +2927 * @param jobId include only events matching the given job ID - optional +2928 * @param reportId include only events matching the given report ID - optional +2929 * @param user include only events created by the given user - optional +2930 * @return a {@link RundeckHistory} instance - won't be null +2931 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2932 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2933 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2934 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2935 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +2936 */ +2937 public RundeckHistory getHistory(String project, String jobId, String reportId, String user) +2938 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2939 return getHistory(project, jobId, reportId, user, null, null, null, null, null); +2940 } +2941 +2942 /** +2943 * Get the (events) history for the given project +2944 * +2945 * @param project name of the project - mandatory +2946 * @param jobId include only events matching the given job ID - optional +2947 * @param reportId include only events matching the given report ID - optional +2948 * @param user include only events created by the given user - optional +2949 * @param max number of results to return - optional (default to 20) +2950 * @param offset the 0-indexed offset for the first result to return - optional (default to O) +2951 * @return a {@link RundeckHistory} instance - won't be null +2952 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2953 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2954 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2955 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2956 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +2957 */ +2958 public RundeckHistory getHistory(String project, String jobId, String reportId, String user, Long max, Long offset) +2959 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2960 return getHistory(project, jobId, reportId, user, null, null, null, max, offset); +2961 } +2962 +2963 /** +2964 * Get the (events) history for the given project +2965 * +2966 * @param project name of the project - mandatory +2967 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y +2968 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2 +2969 * weeks), "5d" (= last 5 days), etc. Optional. +2970 * @return a {@link RundeckHistory} instance - won't be null +2971 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2972 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2973 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2974 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2975 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +2976 */ +2977 public RundeckHistory getHistory(String project, String recent) throws RundeckApiException, +2978 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +2979 return getHistory(project, null, null, null, recent, null, null, null, null); +2980 } +2981 +2982 /** +2983 * Get the (events) history for the given project +2984 * +2985 * @param project name of the project - mandatory +2986 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y +2987 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2 +2988 * weeks), "5d" (= last 5 days), etc. Optional. +2989 * @param max number of results to return - optional (default to 20) +2990 * @param offset the 0-indexed offset for the first result to return - optional (default to O) +2991 * @return a {@link RundeckHistory} instance - won't be null +2992 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +2993 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +2994 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +2995 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +2996 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +2997 */ +2998 public RundeckHistory getHistory(String project, String recent, Long max, Long offset) throws RundeckApiException, +2999 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3000 return getHistory(project, null, null, null, recent, null, null, max, offset); +3001 } +3002 +3003 /** +3004 * Get the (events) history for the given project +3005 * +3006 * @param project name of the project - mandatory +3007 * @param begin date for the earlier events to retrieve - optional +3008 * @param end date for the latest events to retrieve - optional +3009 * @return a {@link RundeckHistory} instance - won't be null +3010 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +3011 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3012 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3013 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +3014 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +3015 */ +3016 public RundeckHistory getHistory(String project, Date begin, Date end) throws RundeckApiException, +3017 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3018 return getHistory(project, null, null, (String)null, (String)null, begin, end, null, null); +3019 } +3020 +3021 /** +3022 * Get the (events) history for the given project +3023 * +3024 * @param project name of the project - mandatory +3025 * @param begin date for the earlier events to retrieve - optional +3026 * @param end date for the latest events to retrieve - optional +3027 * @param max number of results to return - optional (default to 20) +3028 * @param offset the 0-indexed offset for the first result to return - optional (default to O) +3029 * @return a {@link RundeckHistory} instance - won't be null +3030 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +3031 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3032 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3033 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +3034 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long) +3035 */ +3036 public RundeckHistory getHistory(String project, Date begin, Date end, Long max, Long offset) +3037 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3038 return getHistory(project, null, null, (String)null, (String) null, begin, end, max, offset); +3039 } +3040 +3041 /** +3042 * Get the (events) history for the given project +3043 * +3044 * @param project name of the project - mandatory +3045 * @param jobId include only events matching the given job ID - optional +3046 * @param reportId include only events matching the given report ID - optional +3047 * @param user include only events created by the given user - optional +3048 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y +3049 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2 +3050 * weeks), "5d" (= last 5 days), etc. Optional. +3051 * @param begin date for the earlier events to retrieve - optional +3052 * @param end date for the latest events to retrieve - optional +3053 * @param max number of results to return - optional (default to 20) +3054 * @param offset the 0-indexed offset for the first result to return - optional (default to O) +3055 * @return a {@link RundeckHistory} instance - won't be null +3056 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +3057 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3058 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3059 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +3060 */ +3061 public RundeckHistory getHistory(String project, String jobId, String reportId, String user, String recent, +3062 Date begin, Date end, Long max, Long offset) throws RundeckApiException, RundeckApiLoginException, +3063 RundeckApiTokenException, IllegalArgumentException { +3064 AssertUtil.notBlank(project, "project is mandatory to get the history !"); +3065 return new ApiCall(this).get(new ApiPathBuilder("/history").param("project", project) +3066 .param("jobIdFilter", jobId) +3067 .param("reportIdFilter", reportId) +3068 .param("userFilter", user) +3069 .param("recentFilter", recent) +3070 .param("begin", begin) +3071 .param("end", end) +3072 .param("max", max) +3073 .param("offset", offset), +3074 new HistoryParser("result/events")); +3075 } +3076 +3077 /** +3078 * Get the (events) history for the given project +3079 * +3080 * @param project name of the project - mandatory +3081 * @param includeJobNames list of job names ("group/name") to include results for +3082 * @param excludeJobNames list of job names ("group/name") to exclude results for +3083 * @param user include only events created by the given user - optional +3084 * @param recent include only events matching the given period of time. Format : "XY", where X is an +3085 * integer, and Y is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). +3086 * Example : "2w" (= last 2 weeks), "5d" (= last 5 days), etc. Optional. +3087 * @param begin date for the earlier events to retrieve - optional +3088 * @param end date for the latest events to retrieve - optional +3089 * @param max number of results to return - optional (default to 20) +3090 * @param offset the 0-indexed offset for the first result to return - optional (default to O) +3091 * +3092 * @return a {@link RundeckHistory} instance - won't be null +3093 * +3094 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +3095 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3096 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3097 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +3098 */ +3099 public RundeckHistory getHistory(String project, +3100 String user, +3101 String recent, +3102 List<String> includeJobNames, +3103 List<String> excludeJobNames, +3104 Date begin, +3105 Date end, +3106 Long max, +3107 Long offset) +3108 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3109 +3110 AssertUtil.notBlank(project, "project is mandatory to get the history !"); +3111 final ApiPathBuilder builder = new ApiPathBuilder("/history").param("project", project) +3112 .field("jobListFilter", includeJobNames) +3113 .field("excludeJobListFilter", excludeJobNames) +3114 .param("userFilter", user) +3115 .param("recentFilter", recent) +3116 .param("begin", begin) +3117 .param("end", end) +3118 .param("max", max) +3119 .param("offset", offset); +3120 +3121 return new ApiCall(this).postOrGet(builder, new HistoryParser("result/events")); +3122 } +3123 +3124 /* +3125 * Nodes +3126 */ +3127 +3128 /** +3129 * List all nodes (for all projects) +3130 * +3131 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null +3132 * @throws RundeckApiException in case of error when calling the API +3133 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3134 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3135 */ +3136 public List<RundeckNode> getNodes() throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException { +3137 List<RundeckNode> nodes = new ArrayList<RundeckNode>(); +3138 for (RundeckProject project : getProjects()) { +3139 nodes.addAll(getNodes(project.getName())); +3140 } +3141 return nodes; +3142 } +3143 +3144 /** +3145 * List all nodes that belongs to the given project +3146 * +3147 * @param project name of the project - mandatory +3148 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null +3149 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +3150 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3151 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3152 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +3153 * @see #getNodes(String, Properties) +3154 */ +3155 public List<RundeckNode> getNodes(String project) throws RundeckApiException, RundeckApiLoginException, +3156 RundeckApiTokenException, IllegalArgumentException { +3157 return getNodes(project, null); +3158 } +3159 +3160 /** +3161 * List nodes that belongs to the given project +3162 * +3163 * @param project name of the project - mandatory +3164 * @param nodeFilters for filtering the nodes - optional. See {@link NodeFiltersBuilder} +3165 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null +3166 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +3167 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3168 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3169 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +3170 */ +3171 public List<RundeckNode> getNodes(String project, Properties nodeFilters) throws RundeckApiException, +3172 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3173 AssertUtil.notBlank(project, "project is mandatory to get all nodes !"); +3174 return new ApiCall(this).get(new ApiPathBuilder("/resources").param("project", project) +3175 .nodeFilters(nodeFilters), +3176 new ListParser<RundeckNode>(new NodeParser(), "project/node")); +3177 } +3178 +3179 /** +3180 * Get the definition of a single node +3181 * +3182 * @param name of the node - mandatory +3183 * @param project name of the project - mandatory +3184 * @return a {@link RundeckNode} instance - won't be null +3185 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) +3186 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3187 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3188 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) +3189 */ +3190 public RundeckNode getNode(String name, String project) throws RundeckApiException, RundeckApiLoginException, +3191 RundeckApiTokenException, IllegalArgumentException { +3192 AssertUtil.notBlank(name, "the name of the node is mandatory to get a node !"); +3193 AssertUtil.notBlank(project, "project is mandatory to get a node !"); +3194 return new ApiCall(this).get(new ApiPathBuilder("/resource/", name).param("project", project), +3195 new NodeParser("project/node")); +3196 } +3197 +3198 /** +3199 * Get the output of a job execution +3200 * +3201 * @param executionId id of the execution - mandatory +3202 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +3203 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) +3204 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3205 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3206 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) +3207 */ +3208 public InputStream getOutput(String executionId) throws RundeckApiException, RundeckApiLoginException, +3209 RundeckApiTokenException, IllegalArgumentException { +3210 AssertUtil.notBlank(executionId, "the execution id is mandatory to get execution output !"); +3211 return new ApiCall(this).getNonApi(new ApiPathBuilder("/execution/downloadOutput/", executionId)); +3212 } +3213 +3214 /** +3215 * Get the html page of the user's profile +3216 * +3217 * @param username - mandatory +3218 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +3219 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) +3220 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3221 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3222 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) +3223 */ +3224 public InputStream getProfilePage(String username) throws RundeckApiException, RundeckApiLoginException, +3225 RundeckApiTokenException, IllegalArgumentException { +3226 AssertUtil.notBlank(username, "the username is mandatory to get profile page !"); +3227 return new ApiCall(this).getNonApi(new ApiPathBuilder("/user/profile?login=", username)); +3228 } +3229 +3230 +3231 /** +3232 * Generate a new token and get the result page (which is the html page of the user's profile) +3233 * +3234 * @param username - mandatory +3235 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +3236 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) +3237 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3238 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3239 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) +3240 */ +3241 public InputStream generateToken(String username) throws RundeckApiException, RundeckApiLoginException, +3242 RundeckApiTokenException, IllegalArgumentException { +3243 AssertUtil.notBlank(username, "the username is mandatory to generate the token"); +3244 return new ApiCall(this).getNonApi(new ApiPathBuilder("/user/generateApiToken?login=", username)); +3245 } +3246 +3247 +3248 /** +3249 * Get the execution output of the given job +3250 * +3251 * @param executionId identifier of the execution - mandatory +3252 * @param offset byte offset to read from in the file. 0 indicates the beginning. +3253 * @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. +3254 * @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 +3255 * @param maxlines maximum number of lines to retrieve forward from the specified offset. +3256 * @return {@link RundeckOutput} +3257 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +3258 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3259 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3260 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +3261 */ +3262 public RundeckOutput getJobExecutionOutput(Long executionId, int offset, int lastlines, long lastmod, int maxlines) +3263 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3264 AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); +3265 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output.xml").param("offset", offset) +3266 .param("lastlines", lastlines) +3267 .param("lastmod", lastmod) +3268 .param("maxlines", maxlines), +3269 new OutputParser("result/output", createOutputEntryParser())); +3270 } +3271 +3272 +3273 /** +3274 * Get the execution output of the given job +3275 * +3276 * @param executionId identifier of the execution - mandatory +3277 * @param offset byte offset to read from in the file. 0 indicates the beginning. +3278 * @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 +3279 * @param maxlines maximum number of lines to retrieve forward from the specified offset. +3280 * @return {@link RundeckOutput} +3281 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +3282 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3283 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3284 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +3285 */ +3286 public RundeckOutput getJobExecutionOutput(Long executionId, int offset, long lastmod, int maxlines) +3287 throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { +3288 AssertUtil.notNull(executionId, "executionId is mandatory to get the output of a job execution!"); +3289 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/output.xml").param("offset", offset) +3290 .param("lastmod", lastmod) +3291 .param("maxlines", maxlines), +3292 new OutputParser("result/output", createOutputEntryParser())); +3293 } +3294 +3295 private OutputEntryParser createOutputEntryParser() { +3296 if (getApiVersion() <= Version.V5.versionNumber) { +3297 return new OutputEntryParserV5(); +3298 }else{ +3299 return new OutputEntryParser(); +3300 } +3301 } +3302 +3303 +3304 /* +3305 * System Info +3306 */ +3307 +3308 /** +3309 * Get system informations about the RunDeck server +3310 * +3311 * @return a {@link RundeckSystemInfo} instance - won't be null +3312 * @throws RundeckApiException in case of error when calling the API +3313 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) +3314 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) +3315 */ +3316 public RundeckSystemInfo getSystemInfo() throws RundeckApiException, RundeckApiLoginException, +3317 RundeckApiTokenException { +3318 return new ApiCall(this).get(new ApiPathBuilder("/system/info"), new SystemInfoParser("result/system")); +3319 } +3320 +3321 /** +3322 * @return the URL of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) +3323 */ +3324 public String getUrl() { +3325 return url; +3326 } +3327 +3328 /** +3329 * @return the auth-token used for authentication on the RunDeck instance (null if using login-based or session-based auth) +3330 */ +3331 public String getToken() { +3332 return token; +3333 } +3334 +3335 /** +3336 * @return the login used for authentication on the RunDeck instance (null if using token-based or session-based auth) +3337 */ +3338 public String getLogin() { +3339 return login; +3340 } +3341 +3342 /** +3343 * @return the password used for authentication on the RunDeck instance (null if using token-based or session-based auth) +3344 */ +3345 public String getPassword() { +3346 return password; +3347 } +3348 +3349 /** +3350 * @return the sessionID used for authentication on the RunDeck instance (null if using login-based or token-based auth) +3351 */ +3352 public String getSessionID() { +3353 return sessionID; +3354 } +3355 +3356 @Override +3357 public String toString() { +3358 StringBuilder str = new StringBuilder(); +3359 str.append("RundeckClient ").append(API_VERSION); +3360 str.append(" [").append(url).append("] "); +3361 if (token != null) { +3362 str.append("(token=").append(token).append(")"); +3363 } else { +3364 str.append("(credentials=").append(login).append("|").append(password).append(")"); +3365 } +3366 return str.toString(); +3367 } +3368 +3369 @Override +3370 public int hashCode() { +3371 final int prime = 31; +3372 int result = 1; +3373 result = prime * result + ((login == null) ? 0 : login.hashCode()); +3374 result = prime * result + ((password == null) ? 0 : password.hashCode()); +3375 result = prime * result + ((token == null) ? 0 : token.hashCode()); +3376 result = prime * result + ((url == null) ? 0 : url.hashCode()); +3377 return result; +3378 } +3379 +3380 @Override +3381 public boolean equals(Object obj) { +3382 if (this == obj) +3383 return true; +3384 if (obj == null) +3385 return false; +3386 if (getClass() != obj.getClass()) +3387 return false; +3388 RundeckClient other = (RundeckClient) obj; +3389 if (login == null) { +3390 if (other.login != null) 3391 return false; -3392 } else if (!token.equals(other.token)) +3392 } else if (!login.equals(other.login)) 3393 return false; -3394 if (url == null) { -3395 if (other.url != null) +3394 if (password == null) { +3395 if (other.password != null) 3396 return false; -3397 } else if (!url.equals(other.url)) +3397 } else if (!password.equals(other.password)) 3398 return false; -3399 return true; -3400 } -3401 -3402 } +3399 if (token == null) { +3400 if (other.token != null) +3401 return false; +3402 } else if (!token.equals(other.token)) +3403 return false; +3404 if (url == null) { +3405 if (other.url != null) +3406 return false; +3407 } else if (!url.equals(other.url)) +3408 return false; +3409 return true; +3410 } +3411 +3412 }
    diff --git a/xref/org/rundeck/api/RundeckJobsImport.html b/xref/org/rundeck/api/RundeckJobsImport.html index d03c90e..1435133 100644 --- a/xref/org/rundeck/api/RundeckJobsImport.html +++ b/xref/org/rundeck/api/RundeckJobsImport.html @@ -11,37 +11,43 @@ 1 package org.rundeck.api; 2 3 import org.rundeck.api.domain.RundeckJobsImportMethod; -4 -5 import java.io.InputStream; -6 -7 /** -8 * Request to import a set of Job definitions -9 */ -10 public interface RundeckJobsImport { -11 /** -12 * Return the input stream -13 * @return -14 */ -15 public InputStream getStream(); -16 -17 /** -18 * Return the file type -19 * @return -20 */ -21 public FileType getFileType(); -22 -23 /** -24 * Return the import behavior -25 * @return -26 */ -27 public RundeckJobsImportMethod getImportMethod(); -28 +4 import org.rundeck.api.domain.RundeckJobsUUIDImportBehavior; +5 +6 import java.io.InputStream; +7 +8 /** +9 * Request to import a set of Job definitions +10 */ +11 public interface RundeckJobsImport { +12 /** +13 * Return the input stream +14 * @return +15 */ +16 public InputStream getStream(); +17 +18 /** +19 * Return the file type +20 * @return +21 */ +22 public FileType getFileType(); +23 +24 /** +25 * Return the import behavior +26 * @return +27 */ +28 public RundeckJobsImportMethod getImportMethod(); 29 /** -30 * Return the project name +30 * Return the import behavior 31 * @return 32 */ -33 public String getProject(); -34 } +33 public RundeckJobsUUIDImportBehavior getUuidImportBehavior(); +34 +35 /** +36 * Return the project name +37 * @return +38 */ +39 public String getProject(); +40 }
    diff --git a/xref/org/rundeck/api/RundeckJobsImportBuilder.html b/xref/org/rundeck/api/RundeckJobsImportBuilder.html index 1e4a52d..3db7012 100644 --- a/xref/org/rundeck/api/RundeckJobsImportBuilder.html +++ b/xref/org/rundeck/api/RundeckJobsImportBuilder.html @@ -11,70 +11,76 @@ 1 package org.rundeck.api; 2 3 import org.rundeck.api.domain.RundeckJobsImportMethod; -4 -5 import java.io.InputStream; -6 -7 /** -8 * Builds a {@link RundeckJobsImport} -9 */ -10 public class RundeckJobsImportBuilder { -11 private DefaultJobsImport jobsImport; -12 -13 public RundeckJobsImportBuilder() { -14 jobsImport = new DefaultJobsImport(); -15 } -16 -17 public RundeckJobsImportBuilder(final RundeckJobsImport original) { -18 jobsImport = new DefaultJobsImport(); -19 jobsImport.setStream(original.getStream()); -20 jobsImport.setFileType(original.getFileType()); -21 jobsImport.setProject(original.getProject()); -22 jobsImport.setImportMethod(original.getImportMethod()); -23 } -24 -25 /** -26 * Create a new builder -27 * @return -28 */ -29 public static RundeckJobsImportBuilder builder() { -30 return new RundeckJobsImportBuilder(); -31 } -32 -33 /** -34 * Create a builder initialized with an existing {@link RundeckJobsImport} -35 * @param original -36 * @return -37 */ -38 public static RundeckJobsImportBuilder builder(final RundeckJobsImport original) { -39 return new RundeckJobsImportBuilder(original); -40 } -41 -42 public RundeckJobsImportBuilder setProject(final String project) { -43 jobsImport.setProject(project); -44 return this; -45 } -46 -47 public RundeckJobsImportBuilder setStream(final InputStream stream) { -48 jobsImport.setStream(stream); -49 return this; -50 } -51 -52 public RundeckJobsImportBuilder setFileType(final FileType filetype) { -53 jobsImport.setFileType(filetype); -54 return this; -55 } -56 -57 public RundeckJobsImportBuilder setJobsImportMethod(final RundeckJobsImportMethod behavior) { -58 jobsImport.setImportMethod(behavior); -59 return this; -60 } -61 -62 public RundeckJobsImport build() { -63 final RundeckJobsImport built = jobsImport; -64 jobsImport = new DefaultJobsImport(); -65 return built; +4 import org.rundeck.api.domain.RundeckJobsUUIDImportBehavior; +5 +6 import java.io.InputStream; +7 +8 /** +9 * Builds a {@link RundeckJobsImport} +10 */ +11 public class RundeckJobsImportBuilder { +12 private DefaultJobsImport jobsImport; +13 +14 public RundeckJobsImportBuilder() { +15 jobsImport = new DefaultJobsImport(); +16 } +17 +18 public RundeckJobsImportBuilder(final RundeckJobsImport original) { +19 jobsImport = new DefaultJobsImport(); +20 jobsImport.setStream(original.getStream()); +21 jobsImport.setFileType(original.getFileType()); +22 jobsImport.setProject(original.getProject()); +23 jobsImport.setImportMethod(original.getImportMethod()); +24 jobsImport.setUuidImportBehavior(original.getUuidImportBehavior()); +25 } +26 +27 /** +28 * Create a new builder +29 * @return +30 */ +31 public static RundeckJobsImportBuilder builder() { +32 return new RundeckJobsImportBuilder(); +33 } +34 +35 /** +36 * Create a builder initialized with an existing {@link RundeckJobsImport} +37 * @param original +38 * @return +39 */ +40 public static RundeckJobsImportBuilder builder(final RundeckJobsImport original) { +41 return new RundeckJobsImportBuilder(original); +42 } +43 +44 public RundeckJobsImportBuilder setProject(final String project) { +45 jobsImport.setProject(project); +46 return this; +47 } +48 +49 public RundeckJobsImportBuilder setStream(final InputStream stream) { +50 jobsImport.setStream(stream); +51 return this; +52 } +53 +54 public RundeckJobsImportBuilder setFileType(final FileType filetype) { +55 jobsImport.setFileType(filetype); +56 return this; +57 } +58 +59 public RundeckJobsImportBuilder setJobsImportMethod(final RundeckJobsImportMethod behavior) { +60 jobsImport.setImportMethod(behavior); +61 return this; +62 } +63 public RundeckJobsImportBuilder setUUIDImportBehavior(final RundeckJobsUUIDImportBehavior behavior) { +64 jobsImport.setUuidImportBehavior(behavior); +65 return this; 66 } -67 } +67 +68 public RundeckJobsImport build() { +69 final RundeckJobsImport built = jobsImport; +70 jobsImport = new DefaultJobsImport(); +71 return built; +72 } +73 }
    diff --git a/xref/org/rundeck/api/domain/RundeckExecution.html b/xref/org/rundeck/api/domain/RundeckExecution.html index 92d405a..7adc742 100644 --- a/xref/org/rundeck/api/domain/RundeckExecution.html +++ b/xref/org/rundeck/api/domain/RundeckExecution.html @@ -61,229 +61,244 @@ 51 52 private String description; 53 private String argstring; -54 -55 /** -56 * @return the duration of the execution in milliseconds (or null if the duration is still running, or has been -57 * aborted) -58 */ -59 public Long getDurationInMillis() { -60 if (startedAt == null || endedAt == null) { -61 return null; -62 } -63 return endedAt.getTime() - startedAt.getTime(); -64 } -65 -66 /** -67 * @return the duration of the execution in seconds (or null if the execution is still running, or has been aborted) -68 */ -69 public Long getDurationInSeconds() { -70 Long durationInMillis = getDurationInMillis(); -71 return durationInMillis != null ? TimeUnit.MILLISECONDS.toSeconds(durationInMillis) : null; -72 } -73 -74 /** -75 * @return the duration of the execution, as a human-readable string : "3 minutes 34 seconds" (or null if the -76 * execution is still running, or has been aborted) -77 */ -78 public String getDuration() { -79 Long durationInMillis = getDurationInMillis(); -80 return durationInMillis != null ? DurationFormatUtils.formatDurationWords(durationInMillis, true, true) : null; -81 } -82 -83 /** -84 * @return the duration of the execution, as a "short" human-readable string : "0:03:34.187" (or null if the -85 * execution is still running, or has been aborted) -86 */ -87 public String getShortDuration() { -88 Long durationInMillis = getDurationInMillis(); -89 return durationInMillis != null ? DurationFormatUtils.formatDurationHMS(durationInMillis) : null; -90 } -91 -92 public Long getId() { -93 return id; -94 } -95 -96 public void setId(Long id) { -97 this.id = id; -98 } -99 -100 public String getUrl() { -101 return url; -102 } -103 -104 public void setUrl(String url) { -105 this.url = url; -106 } -107 -108 /** -109 * @return the status of the execution - see {@link ExecutionStatus} -110 */ -111 public ExecutionStatus getStatus() { -112 return status; -113 } -114 -115 public void setStatus(ExecutionStatus status) { -116 this.status = status; -117 } -118 -119 /** -120 * @return the {@link RundeckJob} associated with this execution, or null in the case of an ad-hoc execution -121 * (command or script) -122 */ -123 public RundeckJob getJob() { -124 return job; -125 } -126 -127 public void setJob(RundeckJob job) { -128 this.job = job; -129 } -130 -131 public String getStartedBy() { -132 return startedBy; -133 } -134 -135 public void setStartedBy(String startedBy) { -136 this.startedBy = startedBy; -137 } -138 -139 public Date getStartedAt() { -140 return (startedAt != null) ? new Date(startedAt.getTime()) : null; -141 } -142 -143 public void setStartedAt(Date startedAt) { -144 this.startedAt = ((startedAt != null) ? new Date(startedAt.getTime()) : null); -145 } -146 -147 public Date getEndedAt() { -148 return (endedAt != null) ? new Date(endedAt.getTime()) : null; -149 } -150 -151 public void setEndedAt(Date endedAt) { -152 this.endedAt = ((endedAt != null) ? new Date(endedAt.getTime()) : null); -153 } -154 -155 public String getAbortedBy() { -156 return abortedBy; -157 } -158 -159 public void setAbortedBy(String abortedBy) { -160 this.abortedBy = abortedBy; -161 } -162 -163 public String getDescription() { -164 return description; -165 } -166 -167 public void setDescription(String description) { -168 this.description = description; -169 } -170 -171 @Override -172 public String toString() { -173 return "RundeckExecution [id=" + id + ", description=" + description + ", url=" + url + ", status=" + status -174 + ", argstring=" + argstring -175 + ", startedBy=" + startedBy + ", startedAt=" + startedAt + ", endedAt=" + endedAt -176 + ", durationInSeconds=" + getDurationInSeconds() + ", abortedBy=" + abortedBy + ", job=" + job + "]"; -177 } -178 -179 @Override -180 public int hashCode() { -181 final int prime = 31; -182 int result = 1; -183 result = prime * result + ((abortedBy == null) ? 0 : abortedBy.hashCode()); -184 result = prime * result + ((argstring == null) ? 0 : argstring.hashCode()); -185 result = prime * result + ((description == null) ? 0 : description.hashCode()); -186 result = prime * result + ((endedAt == null) ? 0 : endedAt.hashCode()); -187 result = prime * result + ((id == null) ? 0 : id.hashCode()); -188 result = prime * result + ((job == null) ? 0 : job.hashCode()); -189 result = prime * result + ((startedAt == null) ? 0 : startedAt.hashCode()); -190 result = prime * result + ((startedBy == null) ? 0 : startedBy.hashCode()); -191 result = prime * result + ((status == null) ? 0 : status.hashCode()); -192 result = prime * result + ((url == null) ? 0 : url.hashCode()); -193 return result; -194 } -195 -196 @Override -197 public boolean equals(Object obj) { -198 if (this == obj) -199 return true; -200 if (obj == null) -201 return false; -202 if (getClass() != obj.getClass()) +54 private String project; +55 +56 /** +57 * @return the duration of the execution in milliseconds (or null if the duration is still running, or has been +58 * aborted) +59 */ +60 public Long getDurationInMillis() { +61 if (startedAt == null || endedAt == null) { +62 return null; +63 } +64 return endedAt.getTime() - startedAt.getTime(); +65 } +66 +67 /** +68 * @return the duration of the execution in seconds (or null if the execution is still running, or has been aborted) +69 */ +70 public Long getDurationInSeconds() { +71 Long durationInMillis = getDurationInMillis(); +72 return durationInMillis != null ? TimeUnit.MILLISECONDS.toSeconds(durationInMillis) : null; +73 } +74 +75 /** +76 * @return the duration of the execution, as a human-readable string : "3 minutes 34 seconds" (or null if the +77 * execution is still running, or has been aborted) +78 */ +79 public String getDuration() { +80 Long durationInMillis = getDurationInMillis(); +81 return durationInMillis != null ? DurationFormatUtils.formatDurationWords(durationInMillis, true, true) : null; +82 } +83 +84 /** +85 * @return the duration of the execution, as a "short" human-readable string : "0:03:34.187" (or null if the +86 * execution is still running, or has been aborted) +87 */ +88 public String getShortDuration() { +89 Long durationInMillis = getDurationInMillis(); +90 return durationInMillis != null ? DurationFormatUtils.formatDurationHMS(durationInMillis) : null; +91 } +92 +93 public Long getId() { +94 return id; +95 } +96 +97 public void setId(Long id) { +98 this.id = id; +99 } +100 +101 public String getUrl() { +102 return url; +103 } +104 +105 public void setUrl(String url) { +106 this.url = url; +107 } +108 +109 /** +110 * @return the status of the execution - see {@link ExecutionStatus} +111 */ +112 public ExecutionStatus getStatus() { +113 return status; +114 } +115 +116 public void setStatus(ExecutionStatus status) { +117 this.status = status; +118 } +119 +120 /** +121 * @return the {@link RundeckJob} associated with this execution, or null in the case of an ad-hoc execution +122 * (command or script) +123 */ +124 public RundeckJob getJob() { +125 return job; +126 } +127 +128 public void setJob(RundeckJob job) { +129 this.job = job; +130 } +131 +132 public String getStartedBy() { +133 return startedBy; +134 } +135 +136 public void setStartedBy(String startedBy) { +137 this.startedBy = startedBy; +138 } +139 +140 public Date getStartedAt() { +141 return (startedAt != null) ? new Date(startedAt.getTime()) : null; +142 } +143 +144 public void setStartedAt(Date startedAt) { +145 this.startedAt = ((startedAt != null) ? new Date(startedAt.getTime()) : null); +146 } +147 +148 public Date getEndedAt() { +149 return (endedAt != null) ? new Date(endedAt.getTime()) : null; +150 } +151 +152 public void setEndedAt(Date endedAt) { +153 this.endedAt = ((endedAt != null) ? new Date(endedAt.getTime()) : null); +154 } +155 +156 public String getAbortedBy() { +157 return abortedBy; +158 } +159 +160 public void setAbortedBy(String abortedBy) { +161 this.abortedBy = abortedBy; +162 } +163 +164 public String getDescription() { +165 return description; +166 } +167 +168 public void setDescription(String description) { +169 this.description = description; +170 } +171 +172 @Override +173 public String toString() { +174 return "RundeckExecution [id=" + id + ", description=" + description + ", url=" + url + ", status=" + status +175 + ", argstring=" + argstring +176 + ", startedBy=" + startedBy + ", startedAt=" + startedAt + ", endedAt=" + endedAt +177 + ", durationInSeconds=" + getDurationInSeconds() + ", abortedBy=" + abortedBy + ", job=" + job + "]"; +178 } +179 +180 @Override +181 public int hashCode() { +182 final int prime = 31; +183 int result = 1; +184 result = prime * result + ((abortedBy == null) ? 0 : abortedBy.hashCode()); +185 result = prime * result + ((argstring == null) ? 0 : argstring.hashCode()); +186 result = prime * result + ((description == null) ? 0 : description.hashCode()); +187 result = prime * result + ((endedAt == null) ? 0 : endedAt.hashCode()); +188 result = prime * result + ((id == null) ? 0 : id.hashCode()); +189 result = prime * result + ((job == null) ? 0 : job.hashCode()); +190 result = prime * result + ((startedAt == null) ? 0 : startedAt.hashCode()); +191 result = prime * result + ((startedBy == null) ? 0 : startedBy.hashCode()); +192 result = prime * result + ((status == null) ? 0 : status.hashCode()); +193 result = prime * result + ((url == null) ? 0 : url.hashCode()); +194 result = prime * result + ((project == null) ? 0 : project.hashCode()); +195 return result; +196 } +197 +198 @Override +199 public boolean equals(Object obj) { +200 if (this == obj) +201 return true; +202 if (obj == null) 203 return false; -204 RundeckExecution other = (RundeckExecution) obj; -205 if (abortedBy == null) { -206 if (other.abortedBy != null) -207 return false; -208 } else if (!abortedBy.equals(other.abortedBy)) -209 return false; -210 if (argstring == null) { -211 if (other.argstring != null) -212 return false; -213 } else if (!argstring.equals(other.argstring)) -214 return false; -215 if (description == null) { -216 if (other.description != null) -217 return false; -218 } else if (!description.equals(other.description)) -219 return false; -220 if (endedAt == null) { -221 if (other.endedAt != null) -222 return false; -223 } else if (!endedAt.equals(other.endedAt)) -224 return false; -225 if (id == null) { -226 if (other.id != null) -227 return false; -228 } else if (!id.equals(other.id)) -229 return false; -230 if (job == null) { -231 if (other.job != null) -232 return false; -233 } else if (!job.equals(other.job)) -234 return false; -235 if (startedAt == null) { -236 if (other.startedAt != null) -237 return false; -238 } else if (!startedAt.equals(other.startedAt)) -239 return false; -240 if (startedBy == null) { -241 if (other.startedBy != null) -242 return false; -243 } else if (!startedBy.equals(other.startedBy)) -244 return false; -245 if (status == null) { -246 if (other.status != null) -247 return false; -248 } else if (!status.equals(other.status)) -249 return false; -250 if (url == null) { -251 if (other.url != null) -252 return false; -253 } else if (!url.equals(other.url)) -254 return false; -255 return true; -256 } -257 -258 /** -259 * the argument string for the execution -260 */ -261 public String getArgstring() { -262 return argstring; +204 if (getClass() != obj.getClass()) +205 return false; +206 RundeckExecution other = (RundeckExecution) obj; +207 if (abortedBy == null) { +208 if (other.abortedBy != null) +209 return false; +210 } else if (!abortedBy.equals(other.abortedBy)) +211 return false; +212 if (argstring == null) { +213 if (other.argstring != null) +214 return false; +215 } else if (!argstring.equals(other.argstring)) +216 return false; +217 if (description == null) { +218 if (other.description != null) +219 return false; +220 } else if (!description.equals(other.description)) +221 return false; +222 if (endedAt == null) { +223 if (other.endedAt != null) +224 return false; +225 } else if (!endedAt.equals(other.endedAt)) +226 return false; +227 if (id == null) { +228 if (other.id != null) +229 return false; +230 } else if (!id.equals(other.id)) +231 return false; +232 if (job == null) { +233 if (other.job != null) +234 return false; +235 } else if (!job.equals(other.job)) +236 return false; +237 if (startedAt == null) { +238 if (other.startedAt != null) +239 return false; +240 } else if (!startedAt.equals(other.startedAt)) +241 return false; +242 if (startedBy == null) { +243 if (other.startedBy != null) +244 return false; +245 } else if (!startedBy.equals(other.startedBy)) +246 return false; +247 if (status == null) { +248 if (other.status != null) +249 return false; +250 } else if (!status.equals(other.status)) +251 return false; +252 if (url == null) { +253 if (other.url != null) +254 return false; +255 } else if (!url.equals(other.url)) +256 return false; +257 if (project == null) { +258 if (other.project != null) +259 return false; +260 } else if (!project.equals(other.project)) +261 return false; +262 return true; 263 } 264 -265 public void setArgstring(String argstring) { -266 this.argstring = argstring; -267 } -268 -269 /** -270 * The status of an execution -271 */ -272 public static enum ExecutionStatus { -273 RUNNING, SUCCEEDED, FAILED, ABORTED; +265 /** +266 * the argument string for the execution +267 */ +268 public String getArgstring() { +269 return argstring; +270 } +271 +272 public void setArgstring(String argstring) { +273 this.argstring = argstring; 274 } 275 -276 } +276 public String getProject() { +277 return project; +278 } +279 +280 public void setProject(String project) { +281 this.project = project; +282 } +283 +284 /** +285 * The status of an execution +286 */ +287 public static enum ExecutionStatus { +288 RUNNING, SUCCEEDED, FAILED, ABORTED; +289 } +290 +291 }
    diff --git a/xref/org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html b/xref/org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html new file mode 100644 index 0000000..4f30483 --- /dev/null +++ b/xref/org/rundeck/api/domain/RundeckJobsUUIDImportBehavior.html @@ -0,0 +1,23 @@ + + + + +RundeckJobsUUIDImportBehavior xref + + + +
    +
    +1   package org.rundeck.api.domain;
    +2   
    +3   /**
    +4    * $INTERFACE is ... User: greg Date: 1/16/14 Time: 11:38 AM
    +5    */
    +6   public enum RundeckJobsUUIDImportBehavior {
    +7       PRESERVE,
    +8       REMOVE
    +9   }
    +
    +
    + + diff --git a/xref/org/rundeck/api/domain/package-frame.html b/xref/org/rundeck/api/domain/package-frame.html index 330cefd..e62c68f 100644 --- a/xref/org/rundeck/api/domain/package-frame.html +++ b/xref/org/rundeck/api/domain/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.domain + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.domain @@ -53,6 +53,9 @@
  • RundeckJobsImportResult +
  • +
  • + RundeckJobsUUIDImportBehavior
  • RundeckLogLevel diff --git a/xref/org/rundeck/api/domain/package-summary.html b/xref/org/rundeck/api/domain/package-summary.html index 62d5c24..29c5408 100644 --- a/xref/org/rundeck/api/domain/package-summary.html +++ b/xref/org/rundeck/api/domain/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.domain + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.domain @@ -99,6 +99,11 @@
  • + + +
    RundeckJobsImportResult
    + RundeckJobsUUIDImportBehavior +
    @@ -152,6 +157,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref/org/rundeck/api/package-frame.html b/xref/org/rundeck/api/package-frame.html index e1ad5b7..0f1355f 100644 --- a/xref/org/rundeck/api/package-frame.html +++ b/xref/org/rundeck/api/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api diff --git a/xref/org/rundeck/api/package-summary.html b/xref/org/rundeck/api/package-summary.html index b37e085..a614611 100644 --- a/xref/org/rundeck/api/package-summary.html +++ b/xref/org/rundeck/api/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api @@ -202,6 +202,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref/org/rundeck/api/parser/ExecutionParser.html b/xref/org/rundeck/api/parser/ExecutionParser.html index 967ad2e..f0dad87 100644 --- a/xref/org/rundeck/api/parser/ExecutionParser.html +++ b/xref/org/rundeck/api/parser/ExecutionParser.html @@ -70,25 +70,26 @@ 60 execution.setArgstring(StringUtils.trimToNull(execNode.valueOf("argstring"))); 61 execution.setStartedBy(StringUtils.trimToNull(execNode.valueOf("user"))); 62 execution.setAbortedBy(StringUtils.trimToNull(execNode.valueOf("abortedby"))); -63 String startedAt = StringUtils.trimToNull(execNode.valueOf("date-started/@unixtime")); -64 if (startedAt != null) { -65 execution.setStartedAt(new Date(Long.valueOf(startedAt))); -66 } -67 String endedAt = StringUtils.trimToNull(execNode.valueOf("date-ended/@unixtime")); -68 if (endedAt != null) { -69 execution.setEndedAt(new Date(Long.valueOf(endedAt))); -70 } -71 -72 Node jobNode = execNode.selectSingleNode("job"); -73 if (jobNode != null) { -74 RundeckJob job = new JobParser().parseXmlNode(jobNode); -75 execution.setJob(job); -76 } -77 -78 return execution; -79 } -80 -81 } +63 execution.setProject(StringUtils.trimToNull(execNode.valueOf("@project"))); +64 String startedAt = StringUtils.trimToNull(execNode.valueOf("date-started/@unixtime")); +65 if (startedAt != null) { +66 execution.setStartedAt(new Date(Long.valueOf(startedAt))); +67 } +68 String endedAt = StringUtils.trimToNull(execNode.valueOf("date-ended/@unixtime")); +69 if (endedAt != null) { +70 execution.setEndedAt(new Date(Long.valueOf(endedAt))); +71 } +72 +73 Node jobNode = execNode.selectSingleNode("job"); +74 if (jobNode != null) { +75 RundeckJob job = new JobParser().parseXmlNode(jobNode); +76 execution.setJob(job); +77 } +78 +79 return execution; +80 } +81 +82 }
    diff --git a/xref/org/rundeck/api/parser/package-frame.html b/xref/org/rundeck/api/parser/package-frame.html index 0f193af..3b304d1 100644 --- a/xref/org/rundeck/api/parser/package-frame.html +++ b/xref/org/rundeck/api/parser/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.parser + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.parser diff --git a/xref/org/rundeck/api/parser/package-summary.html b/xref/org/rundeck/api/parser/package-summary.html index 3a23da1..2480e89 100644 --- a/xref/org/rundeck/api/parser/package-summary.html +++ b/xref/org/rundeck/api/parser/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.parser + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.parser @@ -152,6 +152,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref/org/rundeck/api/query/package-frame.html b/xref/org/rundeck/api/query/package-frame.html index 4603298..0e96a42 100644 --- a/xref/org/rundeck/api/query/package-frame.html +++ b/xref/org/rundeck/api/query/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.query + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.query diff --git a/xref/org/rundeck/api/query/package-summary.html b/xref/org/rundeck/api/query/package-summary.html index 7a619b1..0519afb 100644 --- a/xref/org/rundeck/api/query/package-summary.html +++ b/xref/org/rundeck/api/query/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.query + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.query @@ -67,6 +67,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref/org/rundeck/api/util/package-frame.html b/xref/org/rundeck/api/util/package-frame.html index a39de6c..53237db 100644 --- a/xref/org/rundeck/api/util/package-frame.html +++ b/xref/org/rundeck/api/util/package-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.util + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.util diff --git a/xref/org/rundeck/api/util/package-summary.html b/xref/org/rundeck/api/util/package-summary.html index d2b54d9..3dcdc2d 100644 --- a/xref/org/rundeck/api/util/package-summary.html +++ b/xref/org/rundeck/api/util/package-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference Package org.rundeck.api.util + RunDeck API - Java Client 9.2-SNAPSHOT Reference Package org.rundeck.api.util @@ -72,6 +72,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file diff --git a/xref/overview-frame.html b/xref/overview-frame.html index 75a8448..11fc738 100644 --- a/xref/overview-frame.html +++ b/xref/overview-frame.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference + RunDeck API - Java Client 9.2-SNAPSHOT Reference diff --git a/xref/overview-summary.html b/xref/overview-summary.html index 2818225..063acc3 100644 --- a/xref/overview-summary.html +++ b/xref/overview-summary.html @@ -3,7 +3,7 @@ - RunDeck API - Java Client 8.0 Reference + RunDeck API - Java Client 9.2-SNAPSHOT Reference @@ -24,7 +24,7 @@ -

    RunDeck API - Java Client 8.0 Reference

    +

    RunDeck API - Java Client 9.2-SNAPSHOT Reference

    @@ -79,6 +79,6 @@
    - Copyright © 2011-2013. All Rights Reserved. + Copyright © 2011-2014. All Rights Reserved. \ No newline at end of file