Inside any automation pipeline there are objects automatically provided to you at execution time which can be accessed without any further allocation steps. Such an object is called Pipeline Object. These objects can be accessed using the Pipeline Expression Language (PEL). Some of them are read-only and some are read-write. Here is an example how to use such an implicite object inside a pipeline:
pipeline: - body.set: "This pipeline was called with id: ${request.params['id']}" |
Here is the reference documentation of these objects:
This object gives you access to all variables of the current pipeline.
Let's assume, you have defined a variable counter
and you would like to access this counter in your expression, then you could write an expression like this:
${vars.counter} |
Here is an example of a pipeline which declares this variable and uses the Pipeline Expression to output the value of counter
to the body:
vars: counter: 12 pipeline: - body.set: value: "The counter is: ${vars.counter}" |
This will result in an output like this:
The counter is: 12 |
Also see Pipeline Expression Language (PEL) .
This object gives you access to all pipeline headers of the current pipeline.
Do not mix up Pipeline headers with HTTP headers. The latter can be accessed using the |
Here is an example of a pipeline which accesses the header attribute contentType
and writes it to the body:
headers: contentType: "text/plain" pipeline: - body.set: value: "The type is: ${headers.contentType}" |
This will result in an output like this:
The type is: text/plain |
Also see Pipeline Expression Language (PEL) .
This object gives you access to the current body of the current pipeline.
Here is an example which defines an initial body value and replaces this with another text in the pipeline:
body: "Hello World" pipeline: - body.set: value: "The text from body is: ${body}" |
This will result in an output like this:
The text from body is: Hello World |
Also see Pipeline Expression Language (PEL) .
This object gives you access to the response of the current request. You can set the response status or headers for example.
The |
Here is an example which sets the HTTP 401 on the current request:
pipeline: - body.set: ${context.response.statusCode = 401} |
This will result in an output like this:
401 |
And it will return the HTTP Status code 401 to the client.
You can also use the command http.response.set in order to set the response values:
pipeline: - http.response.set: statusCode: 401 headers: X-Special: "MyValue" |
Note: The final body of the pipeline will become the body for the response, therefore you cannot set it on the response implicit object. |
These are the attributes accessible via the response
object:
The HTTP status to send back to the client. One of: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
A key-value map which contains the headers to be send back to the client.
This object gives you access to the current request object, if there is any.
Here is an example which reads the contentType
header from the current request:
pipeline: - body.set: "ContentType is: ${request.headers['content-type']}" |
This will result in an output like this:
ContentType is: application/json |
The |
These are the attributes accessible via the request
object:
A key-value map of all HTTP request headers of the current request.
The HTTP request header keys are all lower cased in this map! |
A key-value map of all HTT request query parameters of the current request.
Example:
pipeline: - body.set: "This pipeline was called with id: ${request.params['id']'}" |
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion
, for example, HTTP/1.1
.
The content length of the current request in bytes.
The Content-Type header of the current request. One of the standard content types or a custom one.
The request path of current request without hostname.
The HTTP method used for this request.
The locale used for this request or null if none was set.
The list of cookies linked to this request.
Returns the name of the cookie. The name cannot be changed after creation.
Returns the value of the cookie as string.
Returns the path as string on the server to which the browser returns this cookie. The cookie is visible to all subpaths on the server.
Returns the version integer of the protocol this cookie complies with. Version 1 complies with RFC 2109, and version 0 complies with the original cookie specification drafted by Netscape. Cookies provided by a browser use and identify the browser's cookie version.
Returns the domain name set for this cookie as string. The form of the domain name is set by RFC 2109.
Returns the comment string describing the purpose of this cookie, or null
if the cookie has no comment.
Returns the maximum age of the cookie, specified in seconds. By default, -1 indicating the cookie will persist until browser shutdown.
Returns true
if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.
Gets the flag that controls if this cookie will be hidden from scripts on the client side. Returns true
if the cookie is hidden from scripts, else false
.
Also see: Pipeline Error Handling
In case an exception happened in this pipeline, this object will contain all required information about it. Otherwise this object is null
.
Depending on the exception type the attributes can differ. Below you can find the common attributes always available:
The name of the principal active when this exception happened. This is typically the username of the currently logged-in user or the systemuser
.
The PIPEFORCE domain name (host) where this exception happened.
Returns the exception message as string.
A link to the log files related to this exception.
The PIPEFORCE namespace where this exception happened.
The id of the trace span where this exception happened or null
in case there was no span created.
The id of the tracing where this exception happened. Never null
.
Returns the type (name) of the current exception.
Common types are:
Type | Description |
---|---|
| In case the execution of a pipeline util has been failed. |
| In case the execution of a command has been failed. |
| In case a command was not found. |
| In case an argument to any backend function was invalid. |
| In case a pipeline execution has been failed. |
| This type catches any exception. |
The status code of the exception if there is any. Usually an HTTP status code is assigned with any exception. By default it is set to 500
.
The unix timestamp in millis when this exception happened at the backend.
Returns the unique id of this exception. This is handy for searching in logs for this exact match.