mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-05 20:49:39 +00:00
Wagon: Deploying site to repository
This commit is contained in:
parent
8610ed7d24
commit
0adb38f5b7
171 changed files with 14918 additions and 5530 deletions
60
jruby.html
60
jruby.html
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!-- Generated by Apache Maven Doxia at Nov 6, 2014 -->
|
||||
<!-- Generated by Apache Maven Doxia at Nov 25, 2014 -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript" src="./js/apache-maven-fluido.min.js"></script>
|
||||
|
||||
|
||||
<meta name="Date-Revision-yyyymmdd" content="20141106" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20141125" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
|
||||
<!-- Google Analytics -->
|
||||
|
@ -40,18 +40,18 @@
|
|||
|
||||
|
||||
<li class="">
|
||||
<a href="http://rundeck.org" class="externalLink" title="RunDeck">RunDeck</a>
|
||||
<a href="http://rundeck.org" class="externalLink" title="Rundeck">Rundeck</a>
|
||||
<li class="divider ">/</li>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="./" title="RunDeck API - Java Client">RunDeck API - Java Client</a>
|
||||
<a href="./" title="Rundeck API - Java Client">Rundeck API - Java Client</a>
|
||||
<li class="divider ">/</li>
|
||||
</li>
|
||||
<li class=""></li>
|
||||
|
||||
|
||||
<li id="publishDate" class="pull-right">Last Published: 2014-11-06</li> <li class="divider pull-right">|</li>
|
||||
<li id="projectVersion" class="pull-right">Version: 11.1</li>
|
||||
<li id="publishDate" class="pull-right">Last Published: 2014-11-25</li> <li class="divider pull-right">|</li>
|
||||
<li id="projectVersion" class="pull-right">Version: 12.0</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -119,36 +119,36 @@
|
|||
<div id="bodyColumn" class="content">
|
||||
<div id="contentBox">
|
||||
|
||||
<div class="section"><h2>Using the RunDeck API from JRuby scripts<a name="Using_the_RunDeck_API_from_JRuby_scripts"></a></h2></div><p>Here are some examples of what you can do with this lib and a few lines of <a class="externalLink" href="http://www.jruby.org/">Ruby</a> (for the rubyist that don't fear running on the JVM !)</p><p>You will have to <a href="./download.html">download</a> the lib (the .jar file) to use it...</p><div class="section"><h3>Basic usage<a name="Basic_usage"></a></h3></div><p>Save the following script in a file named "<tt>rundeck.rb</tt>", and execute it with "<tt>jruby rundeck.rb</tt>".</p><div class="source"><pre class="prettyprint">require 'java'
|
||||
<div class="section"><h2>Using the Rundeck API from JRuby scripts<a name="Using_the_Rundeck_API_from_JRuby_scripts"></a></h2></div><p>Here are some examples of what you can do with this lib and a few lines of <a class="externalLink" href="http://www.jruby.org/">Ruby</a> (for the rubyist that don't fear running on the JVM !)</p><p>You will have to <a href="./download.html">download</a> the lib (the .jar file) to use it...</p><div class="section"><h3>Basic usage<a name="Basic_usage"></a></h3></div><p>Save the following script in a file named "<tt>rundeck.rb</tt>", and execute it with "<tt>jruby rundeck.rb</tt>".</p><div class="source"><pre class="prettyprint">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}"
|
||||
puts "All RunDeck nodes : #{rundeck.nodes}"
|
||||
puts "All RunDeck jobs : #{rundeck.jobs}"
|
||||
puts "All RunDeck running executions : #{rundeck.runningExecutions}"
|
||||
puts "Rundeck uptime : #{rundeck.systemInfo.uptime}"
|
||||
puts "All Rundeck projects : #{rundeck.projects}"
|
||||
puts "All Rundeck nodes : #{rundeck.nodes}"
|
||||
puts "All Rundeck jobs : #{rundeck.jobs}"
|
||||
puts "All Rundeck running executions : #{rundeck.runningExecutions}"
|
||||
</pre></div><p>You can also add the library to the classpath : save the following script in a file named "<tt>rundeck.rb</tt>", and execute it with "<tt>jruby -rjava -J-cp /path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar rundeck.rb</tt>".</p><div class="source"><pre class="prettyprint">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}"
|
||||
puts "All RunDeck nodes : #{rundeck.nodes}"
|
||||
puts "All RunDeck jobs : #{rundeck.jobs}"
|
||||
puts "All RunDeck running executions : #{rundeck.runningExecutions}"
|
||||
</pre></div><div class="section"><h3>Authentication<a name="Authentication"></a></h3></div><p>Starting with RunDeck API 2, there are 2 ways to authenticate :</p><ul><li>the <b>login-based authentication</b> : with your login and password</li><li>the <b>token-based authentication</b> : with a unique token that you can generate from the RunDeck webUI</li></ul><div class="source"><pre class="prettyprint">// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) :
|
||||
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin");
|
||||
puts "Rundeck uptime : #{rundeck.systemInfo.uptime}"
|
||||
puts "All Rundeck projects : #{rundeck.projects}"
|
||||
puts "All Rundeck nodes : #{rundeck.nodes}"
|
||||
puts "All Rundeck jobs : #{rundeck.jobs}"
|
||||
puts "All Rundeck running executions : #{rundeck.runningExecutions}"
|
||||
</pre></div><div class="section"><h3>Authentication<a name="Authentication"></a></h3></div><p>Starting with Rundeck API 2, there are 2 ways to authenticate :</p><ul><li>the <b>login-based authentication</b> : with your login and password</li><li>the <b>token-based authentication</b> : with a unique token that you can generate from the Rundeck webUI</li></ul><div class="source"><pre class="prettyprint">// 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()
|
||||
</pre></div><div class="section"><h3>Running a job<a name="Running_a_job"></a></h3></div><div class="source"><pre class="prettyprint">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")
|
||||
|
@ -170,9 +170,9 @@ puts "Execution finished ! Status : #{execution.status}, duration : #{execu
|
|||
</pre></div><div class="section"><h3>Running an ad-hoc command<a name="Running_an_ad-hoc_command"></a></h3></div><div class="source"><pre class="prettyprint">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
|
||||
// trigger the execution of the "uptime" command on the Rundeck server
|
||||
execution = rundeck.triggerAdhocCommand("my-project", "uptime")
|
||||
|
||||
// run the "uptime" command on all unix nodes
|
||||
|
@ -181,24 +181,24 @@ execution = rundeck.runAdhocCommand("my-project", "uptime",
|
|||
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
|
||||
// trigger the execution of a custom bash script on the Rundeck server
|
||||
execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh")
|
||||
|
||||
// run a bash script (with options) on all unix nodes
|
||||
execution = rundeck.runAdhocCommand("my-project", "/tmp/my-script-with-options.sh", OptionsBuilder.new().addOption("option1", "value one").toProperties(), NodeFiltersBuilder.new().osFamily("unix").toProperties())
|
||||
</pre></div><div class="section"><h3>Exporting jobs<a name="Exporting_jobs"></a></h3></div><div class="source"><pre class="prettyprint">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")
|
||||
</pre></div><div class="section"><h3>Importing jobs<a name="Importing_jobs"></a></h3></div><div class="source"><pre class="prettyprint">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"
|
||||
</pre></div><div class="section"><h3>And more...<a name="And_more..."></a></h3></div><p>See the API documentation of the <a href="./apidocs/reference/org/rundeck/api/RundeckClient.html">RundeckClient</a> class for more interactions with your RunDeck instance...</p>
|
||||
</pre></div><div class="section"><h3>And more...<a name="And_more..."></a></h3></div><p>See the API documentation of the <a href="./apidocs/reference/org/rundeck/api/RundeckClient.html">RundeckClient</a> class for more interactions with your Rundeck instance...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue