diff --git a/src/site/confluence/groovy.confluence b/src/site/confluence/groovy.confluence index 6dc06e5..e5366a4 100644 --- a/src/site/confluence/groovy.confluence +++ b/src/site/confluence/groovy.confluence @@ -11,10 +11,10 @@ Save the following script in a file named "{{rundeck.groovy}}", and execute it w {code} // we use Grape (Ivy) to download the lib (and its dependencies) from Maven Central Repository -@Grab(group='org.rundeck', module='rundeck-api-java-client', version='2.0') +@Grab(group='org.rundeck', module='rundeck-api-java-client', version='12.0') import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() println "RunDeck uptime : ${rundeck.systemInfo.uptime}" println "All RunDeck projects : ${rundeck.projects}" @@ -28,7 +28,7 @@ You can also [download|./download.html] the lib and all its dependencies in 1 bi {code} import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() println "RunDeck uptime : ${rundeck.systemInfo.uptime}" println "All RunDeck projects : ${rundeck.projects}" @@ -44,18 +44,18 @@ Starting with RunDeck API 2, there are 2 ways to authenticate : * the *token-based authentication* : with a unique token that you can generate from the RunDeck webUI {code} -// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) : -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin"); +// using login-based authentication (admin/admin is the default login/password for a new Rundeck instance) : +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // using token-based authentication : -rundeck = new RundeckClient("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD"); +rundeck = RundeckClient.builder().url("http://localhost:4440").token("PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD").build() {code} h2. Running a job {code} import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // find a job from its name, group and project job = rundeck.findJob("my-project", "main-group/sub-group", "job-name") @@ -80,7 +80,7 @@ h2. Running an ad-hoc command {code} import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // trigger the execution of the "uptime" command on the RunDeck server execution = rundeck.triggerAdhocCommand("my-project", "uptime") @@ -93,7 +93,7 @@ h2. Running an ad-hoc script {code} import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // trigger the execution of a custom bash script on the RunDeck server execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh") @@ -106,7 +106,7 @@ h2. Exporting jobs {code} import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() rundeck.exportJobsToFile("/tmp/jobs.xml", "xml", "my-project") rundeck.exportJobToFile("/tmp/job.yaml", "yaml", "job-id") @@ -116,7 +116,7 @@ h2. Importing jobs {code} import org.rundeck.api.RundeckClient -rundeck = new RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() result = rundeck.importJobs("/tmp/jobs.xml", "xml") println "${result.succeededJobs.size} jobs successfully imported, ${result.skippedJobs.size} jobs skipped, and ${result.failedJobs.size} jobs failed" diff --git a/src/site/confluence/jruby.confluence b/src/site/confluence/jruby.confluence index cedb4ae..be1abf4 100644 --- a/src/site/confluence/jruby.confluence +++ b/src/site/confluence/jruby.confluence @@ -14,7 +14,7 @@ require 'java' require '/path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar' import org.rundeck.api.RundeckClient -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() puts "RunDeck uptime : #{rundeck.systemInfo.uptime}" puts "All RunDeck projects : #{rundeck.projects}" @@ -28,7 +28,7 @@ You can also add the library to the classpath : save the following script in a f {code} import org.rundeck.api.RundeckClient -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() puts "RunDeck uptime : #{rundeck.systemInfo.uptime}" puts "All RunDeck projects : #{rundeck.projects}" @@ -44,11 +44,11 @@ Starting with RunDeck API 2, there are 2 ways to authenticate : * the *token-based authentication* : with a unique token that you can generate from the RunDeck webUI {code} -// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) : -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin"); +// using login-based authentication (admin/admin is the default login/password for a new Rundeck instance) : +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // using token-based authentication : -rundeck = RundeckClient.new("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD"); +rundeck = RundeckClient.builder().url("http://localhost:4440").token("PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD").build() {code} h2. Running a job @@ -58,7 +58,7 @@ import org.rundeck.api.RundeckClient import org.rundeck.api.OptionsBuilder import org.rundeck.api.NodeFiltersBuilder -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // find a job from its name, group and project job = rundeck.findJob("my-project", "main-group/sub-group", "job-name") @@ -85,7 +85,7 @@ h2. Running an ad-hoc command import org.rundeck.api.RundeckClient import org.rundeck.api.NodeFiltersBuilder -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // trigger the execution of the "uptime" command on the RunDeck server execution = rundeck.triggerAdhocCommand("my-project", "uptime") @@ -101,7 +101,7 @@ import org.rundeck.api.RundeckClient import org.rundeck.api.OptionsBuilder import org.rundeck.api.NodeFiltersBuilder -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // trigger the execution of a custom bash script on the RunDeck server execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh") @@ -114,7 +114,7 @@ h2. Exporting jobs {code} import org.rundeck.api.RundeckClient -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() rundeck.exportJobsToFile("/tmp/jobs.xml", "xml", "my-project") rundeck.exportJobToFile("/tmp/job.yaml", "yaml", "job-id") @@ -124,7 +124,7 @@ h2. Importing jobs {code} import org.rundeck.api.RundeckClient -rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() result = rundeck.importJobs("/tmp/jobs.xml", "xml") puts "#{result.succeededJobs.size} jobs successfully imported, #{result.skippedJobs.size} jobs skipped, and #{result.failedJobs.size} jobs failed" diff --git a/src/site/confluence/jython.confluence b/src/site/confluence/jython.confluence index b2dbc94..88019aa 100644 --- a/src/site/confluence/jython.confluence +++ b/src/site/confluence/jython.confluence @@ -12,7 +12,7 @@ Save the following script in a file named "{{rundeck.py}}", and execute it with {code} from org.rundeck.api import RundeckClient -rundeck = RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() print("RunDeck uptime : %s" % rundeck.systemInfo.uptime) print("All RunDeck projects : %s" % rundeck.projects) @@ -28,11 +28,11 @@ Starting with RunDeck API 2, there are 2 ways to authenticate : * the *token-based authentication* : with a unique token that you can generate from the RunDeck webUI {code} -// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) : -rundeck = RundeckClient("http://localhost:4440", "admin", "admin"); +// using login-based authentication (admin/admin is the default login/password for a new Rundeck instance) : +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // using token-based authentication : -rundeck = RundeckClient("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD"); +rundeck = RundeckClient.builder().url("http://localhost:4440").token("PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD").build() {code} h2. Running a job @@ -42,7 +42,7 @@ from org.rundeck.api import RundeckClient from org.rundeck.api import OptionsBuilder from org.rundeck.api import NodeFiltersBuilder -rundeck = RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // find a job from its name, group and project job = rundeck.findJob("my-project", "main-group/sub-group", "job-name") @@ -69,7 +69,7 @@ h2. Running an ad-hoc command from org.rundeck.api import RundeckClient from org.rundeck.api import NodeFiltersBuilder -rundeck = RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // trigger the execution of the "uptime" command on the RunDeck server execution = rundeck.triggerAdhocCommand("my-project", "uptime") @@ -85,7 +85,7 @@ from org.rundeck.api import RundeckClient from org.rundeck.api import OptionsBuilder from org.rundeck.api import NodeFiltersBuilder -rundeck = RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() // trigger the execution of a custom bash script on the RunDeck server execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh") @@ -98,7 +98,7 @@ h2. Exporting jobs {code} from org.rundeck.api import RundeckClient -rundeck = RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() rundeck.exportJobsToFile("/tmp/jobs.xml", "xml", "my-project") rundeck.exportJobToFile("/tmp/job.yaml", "yaml", "job-id") @@ -108,7 +108,7 @@ h2. Importing jobs {code} from org.rundeck.api import RundeckClient -rundeck = RundeckClient("http://localhost:4440", "admin", "admin") +rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build() result = rundeck.importJobs("/tmp/jobs.xml", "xml") print("%s jobs successfully imported, %s jobs skipped, and %s jobs failed" % (result.succeededJobs.size, result.skippedJobs.size, result.failedJobs.size))