API Reference
This documentation describes the functionality that is available for configuration authors.
Documentation describing the functionality and schema of configuration (workflow, bootstrap etc.) is referred to as the model and is available below.
Documentation describing the functionality and schema of the testing harness is available below.
Packages available:
- Model
- Testing
opscotch configuration model
The opscotch model is relatively straight forward, and uses repeated patterns - once you grasp these you should be able to understand the entire structure.
Here is the outline of the entire structure of the two configurations: the bootstrap and the workflow. Note that not every field is required, so be sure to check the detailed descriptions.
The bootstrap schema
[
{
"agentPrivateKey": "",
"deploymentId": "",
"remoteConfiguration": "",
"remoteConfigurationAuth": "",
"frequency": 0,
"errorHandling": {
"enableLocalLogging": true,
"metrics": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
},
"logs": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
},
"redactionPatterns": [
""
]
},
"workflow" : {
"metricOutput": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
},
"errorHandling": {
"enableLocalLogging": true,
"metrics": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
},
"logs": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
}
}
},
"hosts": {
"": {
"authenticationHost" : false,
"host": "",
"headers": {
"": ""
},
"allowlist": [
["",""]
],
"data": {}
}
},
"persistenceRoot" : "",
"data": {}
}
]
The workflow schema
{
"workflows": [
{
"enabled": true,
"name": "",
"steps": [
{
"enabled": true,
"debug": true,
"type": "",
"stepId": "",
"trigger" : {
"timer" : {
"delay" : 0,
"period" : 0
},
"runOnce" : true
},
"authenticationProcessor": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"splitGenerator": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"urlGenerator": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"payloadGenerator": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"itemResultProcessor": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"resultsProcessor": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"httpStatusHandling": {
"" : {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
}
},
"httpConnectFailedProcessor": {
"script": "",
"resource": "",
"processors" : [
{
"script": "",
"resource": ""
"data": {}
}
],
"data": {}
},
"timer": "",
"persistenceFile" : "",
"data": {}
}
],
"data" : {},
}
]
}
JSON Schema in the Bootstrap Package:
Bootstrap JSON Schemas
Bootstrap
A configuration that is loaded into the agent at startup and determines how the agent loads the main configuration is loaded.
Please note that the bootstap file that is authored is an ARRAY of these objects ie:
[
{
"agentPrivateKey": ...
"deploymentId": ...
}
]
It will be provided to the agent as an argument, either via a base64 encoded json text or a path to a json file
JSON Properties
The following properties are available to set on the JSON schema.
agentPrivateKey
Type: String
Required The private key for the agent to decrypt the remote configuration.
This should be a base64 encoded private key in pkcs8 format
This is how to create an appropriate key
1. Create key pair
openssl genrsa -out keypair.pem 2048
2. Extract public part
openssl rsa -in keypair.pem -pubout -out public.key
3. Extract private part
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out private.key
4. Base64 the contents of this file
cat private.key | base64
{
"agentPrivateKey": "LS0tLS1CRUdJTiBQUklWQV...."
}
This property is required
deploymentId
Type: String
Required A Service Provider defined value that must be unique per deployed agent configuration.
This property is used by Service Provider downstream processor to enrich the transmitted data.
{
"deploymentId": "dogurj"
}
This property is required
remoteConfiguration
Type: String
Required A URL or file path to the main configuration.
The main configuration does not exist, the agent will wait until it becomes available.
{
"remoteConfiguration": "http://www.example.com",
"remoteConfigurationAuth" : "xodsjfujrhdjfk",
"frequency" : 60000
}
This property is required
remoteConfigurationAuth
Type: String
When using a URL remoteConfiguration, setting this property will set the "Authorization" header
{
"remoteConfiguration": "http://www.example.com",
"remoteConfigurationAuth" : "xodsjfujrhdjfk",
"frequency" : 60000
}
This property is optional
frequency
Type: Integer
When using a URL Bootstrap.remoteConfiguration, setting this property will set the polling period in milliseconds
{
"remoteConfiguration": "http://www.example.com",
"remoteConfigurationAuth" : "xodsjfujrhdjfk",
"frequency" : 60000
}
This property is optional
errorHandling
Type: ErrorHandling
Determines the behavior of error handling while loading the main configuration
{
"errorHandling": {
...
}
}
This property is optional
workflow
Type: WorkflowOutputs
Required
Determines metric and log outputs for the workflows
{
"workflow": {
...
}
}
This property is required
hosts
Type: Object of Host
A set of named Host objects. This allows the bootstrap to define http(s) host that can be called from the main configuration.
{
"hosts": {
"mynamedhost": {
"host": "https://www.example.com",
"headers": {
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, *\/*"
},
"allowlist" : [
["GET", "/this/is/allowed.*"],
["POST", "/this/.*\/allowed"]
],
"data" : {
}
}
}
}
This property is optional
persistenceRoot
Type: String
Defines the filesystem storage root for persistence
{
"persistenceRoot": "/storage"
}
This property is optional
data
Type: Object
A JSON Object for adding properties.
These properties will be merged with the WorkflowConfiguration.data configuration field and be available to all child elements in the main configuration tree.
{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3]
}
}
This property is optional
ErrorHandling
A configuration defining if and how to send error metrics or log to a remote system
JSON Properties
The following properties are available to set on the JSON schema.
enableLocalLogging
Type: Boolean
Enable or disables logging of errors and information to the agent standard out
Defaults to false
{
"enableLocalLogging": true
}
This property is optional
metrics
Type: Output
Defines how error metrics are sent to a remote system.
Error metrics represent a fault in the agent and are sent to a remote system for attention.
Error metric configuration only apply to the process configuration they are defined for. For example the Bootstrap.errorHandling defines error handling while loading configurations, and the WorkflowConfiguration.errorHandling defines error handling during the execution of configuration steps.
{
"metrics": {
...
}
}
This property is optional
logs
Type: Output
Defines how error logs are sent to a remote system.
Error logs are brief messages from a fault in the agent and are sent to a remote system for attention.
Error log configuration only apply to the process configuration they are defined for. For example the Bootstrap.errorHandling defines error handling while loading configurations, and the WorkflowConfiguration.errorHandling defines error handling during the execution of configuration steps.
{
"logs": {
...
}
}
This property is optional
redactionPatterns
Type: Array of String
Defines regex patterns to apply redaction to log statements
Log statements from will have these redaction patterns applied before logging.
{
"redactionPatterns": [
"[0-9]+"
]
}
This property is optional
Host
A HTTP(S) host that the agent is expected to communicate with.
This only applies to customer specific hosts, not to Service Provider hosts.
Hosts are defined in Bootstrap.data and WorkflowConfiguration.data
JSON Properties
The following properties are available to set on the JSON schema.
host
Type: String
Required A URL that is used as the base for constructing URLs to call.
{
"host": "https://www.example.com:8080"
}
This property is required
headers
Type: Object of Strings
A object of HTTP headers to be sent with every call.
{
"headers": {
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, *\/*"
}
}
This property is optional
allowlist
Type: Array of String tuple
A list of allowed paths that may be called on this host.
A list of regex that will be matched to URL path. Matching results will be allowed, non-matching results will be blocked and logged.
{
"allowlist": [
["GET","/this/is/allowed"],
["POST","/this/.*\/allowed"]
]
}
This property is optional
authenticationHost
Type: Boolean
When set to true the host can only be used by an authentication context,
when set to false (default) the host can only be used by a non-authentication context.
{
"authenticationHost": true
}
Defaults to false
This property is optional
data
Type: Object
A JSON Object with Additional properties that will accessible during authentication steps.
You can use environment variables in the form of ${NAME} anywhere in the data structure:
the environment variable will be substituted prior to parsing.
Strings in the data structure (after environment variable substitution) can be encrypted using the opscotch packager. Values will be decrypted at access time.
Encryption is done via the packaging tool and requires the agent public key.
{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3],
"<some encrypted string>" : {
"abc" : "<some encrypted value>"
}
}
}
This property is optional
Output
Configuration for how to send data to a remote system.
JSON Properties
The following properties are available to set on the JSON schema.