Skip to main content

🔒 ONES Camunda

Suitable EnviromentSaaS
Private Deployment
ABILITY DESCRIPTION

This ability has not yet been disclosed to the outside, so it is private.

Requirements​

ONES@ones-op/node-ability
v6.1.3v0.12.0

Overview​

The plugin obtains configuration of ONES Camunda through the SDK provided by this ability , allowing it to use Camunda API to call internal Camunda services.

Usage​

Step 1: Add ability​

1. Select the ability.​

Execute the npx op add ability instruction under the root directory of the plugin project, and select: camunda@1.0.0.

2. After the execution is completed, the plugin.yaml configuration will be automatically updated and a module template file will be generated.​

  • A new configuration will be added under the abilities attribute. The configuration is as follows:

    config/plugin.yaml
    abilities:
    - id: TJFPVK8y
    name: camundaApi
    version: 1.0.0
    abilityType: Camunda

Step 2:Installation dependency​

Enter the /backend directory of the plugin project, and execute the following command for dependent installation:

npm i @ones-op/node-ability

Step 3:Ability to use​

Using getCamundaAccessInfo method, the plugin can obtain ONES Camunda resource configuration information.

And ONES Camunda configuration information is described as follows:

ParameterTypesIllustrate
endpoint_urlstringCamunda API url
api_userstringCamunda API user
api_passwordstringCamunda API password

Example​

The plugin uses getCamundaAccessInfo to obtain ONES Camunda resource configuration information, and then obtains the version of the Camunda service by Camunda API.

The sample code is as follows:

import { OPFetch } from '@ones-op/fetch'
import { getCamundaAccessInfo } from '@ones-op/node-ability'

const resBodyExample = {
statusCode: 200,
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
body: {
result: true,
message: '' as any,
},
}

async function getCamundaVersion(camunda) {
try {
const resp = await OPFetch('/version', {
baseURL: `${camunda.endpoint_url}`,
auth: {
username: `${camunda.api_user}`,
password: `${camunda.api_password}`,
},
method: 'GET',
headers: {
Accept: 'application/json',
},
})
return resp.data
} catch (error: any) {
Logger.error('[resp] error:', error.message)
}

return
}

export async function pluginCamundaTest(request: PluginRequest): Promise<PluginResponse> {
const res = resBodyExample

try {
const camunda = await getCamundaAccessInfo()
Logger.info('getCamundaAccessInfo() response:', camunda)

//The plugin can use this Camunda information to perform some Camunda API operations.
//For example, get version of Camunda by Camunda API
const version = await getCamundaVersion(camunda)
Logger.info('getCamundaVersion() version:', version)
} catch (error: any) {
res.body.result = false
res.body.message = error.message
}

return res
}