Example - Enable a maintenance page using REST API
We use cURL and the HTTP methods POST and GET to manipulate the Airlock Gateway configuration according to our REST documentation. All steps are performed as a tenant-user with limited REST API access according to our security considerations.
Goal
Enable a maintenance page using a tenant-users login via REST interface.
Prerequisites
- A tenant-user has been set up correctly.
- A virtual host including mapping and back-end has been set up and belongs to the tenant-user.
- The back-end uses port 80.
Set authorization for tenant-user access
To authorize a tenant-user to perform any kind of reading or writing action via REST API, an authorized JWT needs to be generated together with the respective access rights. This has to be done using the airlock-user-manager-tool
.
Info
Use airlock-user-manager-tool --help
to receive a list of the available functionality of this tool.
Example
Example:
airlock-user-manager-tool -s -u tenant_user -j -r airlock-administrator -W "^\/session\/(create|terminate)|\/configuration\/configurations\/(load-active|activate)|\/configuration\/(virtual-hosts)\/\d{1,10}\/maintenance$" -R "^\/configuration\/(virtual-hosts.*)$" -t myTenant
Instruction - Enable maintenance page via REST-interface
- Create a REST session as a tenant-user.
- Load the active Gateway configuration.
- The configuration can now be changed.
- Change the configuration to activate the maintenance page on virtual host webapp.ext.virtinc.com. Run:
- Terminal box
curl "https://${AIRLOCK}/airlock/rest/configuration/virtual-hosts/webapp.ext.virtinc.com/maintenance" -i -X POST \ -H 'Accept: application/json' \ -H "Cookie: JSESSIONID=${JSESSIONID}" \ -H 'Content-Type: application/json'
- Activate the manipulated configuration on the Gateway.
- When accessing webapp.ext.virtinc.com , the maintenance page is shown.