...
To create valid access tokens there must be the folder rest
in live/sos
. See the attached file createApiAccessToken
file.
The given user in the private.conf file must have A user that has been granted at least the permission sos:products:joc_cockpit:history:view
permission has to be specified in the private.conf
file must have. More information about the private.conf
file can be found in the section below.
Object Creation
To create the object:
...
Code Block |
---|
<job order="yes" stop_on_error="no" name="createApiAccessToken"> <script language="java" java_class_path="" java_class="com.sos.jitl.restclient.CreateApiAccessToken"/> <run_time /> </job> |
Anchor | ||||
---|---|---|---|---|
|
...
private.conf Configuration File
- The
private.conf
file is located in the directory/config/private
directory. - The value for the joc.acount parameter is base64 encoded
username:password
base64 encoded.
Code Block |
---|
joc.webservice.jitl{
joc.account="YXBpX3VzZXI6YXBp"
joc.url = "http://localhost:4446"
}
|
This code is used in the check pre-processor of the check_start job in the example download archive.
Code Block |
---|
<job title="Check the last job run with monitor" stop_on_error="no" order="yes">
<settings >
<log_level ><![CDATA[debug9]]></log_level>
</settings>
<description >
<include file="jobs/JobSchedulerCheckHistory.xml"/>
</description>
<params />
<script language="java:javascript">
<![CDATA[function spooler_process() {
// using the current job name
var jobHistoryInfo = getJobHistoryInfoObject("job1");
report( jobHistoryInfo.getLastCompleted() );
return false;
}
function getJobHistoryInfoObject(jobname, timelimit) {
var jobHistory = new Packages.com.sos.jitl.checkhistory.JobHistory( spooler.delegate );
if ((jobname === undefined) || (jobname === "")) {
jobname = spooler_task.job.name;
}
if (timelimit === undefined) {
timelimit = "";
}
var jobHistoryInfo = jobHistory.getJobInfo( jobname, timelimit );
return jobHistoryInfo;
}
function report( reportItem ) {
if (reportItem.found) {
spooler_log.info( "Name:" + reportItem.name );
spooler_log.info( "Start Time: " + reportItem.start );
spooler_log.info( "End Time: " + reportItem.end );
} else {
spooler_log.info( "Name: " + reportItem.name + " not found" );
}
}
]]>
</script>
<monitor name="apiAccessToken" ordering="0">
<script language="java" java_class="com.sos.jitl.restclient.CreateApiAccessToken"/>
</monitor>
<run_time />
</job> |
...