-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): Add doc generation to element template generator (hackday…
…s) (#3067) * feat(docs): Enhance the element template generator with docs generation support. (Prototype) * feat(docs): Add maven plugin support * feat(docs): Enhance the element template generator with docs generation support. (Prototype) * chore(example): Support an easy way of creating data examples with FEEL expression support * chore(format): Format code * chore(license): Add missing license headers * chore(code): Fix interface * chore(code): Fix test * chore(code): Use maven project base dir. * chore(format): Format * chore(format): Refine secret rendering. * chore(format): Refine secret rendering. * chore(json): Sort json keys * chore(format): Format code
- Loading branch information
Showing
38 changed files
with
1,056 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
![{{name}} connector icon]({{icon}}) | ||
# {{name}} | ||
|
||
{{ description }} | ||
|
||
{% block content %}Connector docs content{% endblock %} | ||
|
||
{% block footer %} | ||
| Connector Info | | | ||
| --- | --- | | ||
| Type | {{ type }} | | ||
| Version | {{ version }} | | ||
| Supported element types | {% for elementType in elementTypes %}{{ elementType }}{% endfor %} | | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
{% extends "../../CONNECTOR_README_LAYOUT.peb" %} | ||
|
||
{% block content %} | ||
# Camunda HTTP JSON Connector | ||
|
||
Find the user documentation in our [Camunda](https://docs.camunda.io/docs/components/integration-framework/connectors/out-of-the-box-connectors/rest/). | ||
|
||
## Build | ||
|
||
```bash | ||
mvn clean package | ||
``` | ||
|
||
## API | ||
|
||
### Input | ||
|
||
```json | ||
{ | ||
"method": "post", | ||
"url": "https://httpbin.org/anything", | ||
"queryParameters": { | ||
"q": "test", | ||
"priority": 12 | ||
}, | ||
"headers": { | ||
"User-Agent": "http-connector-demo" | ||
}, | ||
"body": { | ||
"customer": { | ||
"id": 1231231, | ||
"name": "Jane Doe", | ||
"email": "[email protected]" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Output | ||
|
||
The response will contain the status code, the headers and the body of the response of the HTTP service. | ||
|
||
```json | ||
{ | ||
"body": { | ||
"args": { | ||
"priority": "12", | ||
"q": "test" | ||
}, | ||
"data": "{\"customer\":{\"id\":1231231.0,\"name\":\"Jane Doe\",\"email\":\"[email protected]\"}}", | ||
"files": {}, | ||
"form": {}, | ||
"headers": { | ||
"Accept-Encoding": "gzip", | ||
"Content-Length": "77", | ||
"Content-Type": "application/json", | ||
"Host": "httpbin.org", | ||
"User-Agent": "http-connector-demo Google-HTTP-Java-Client/1.41.4 (gzip)", | ||
"X-Amzn-Trace-Id": "Root=1-623105a8-35f88bac0c7f1dcf0d2c8aa2" | ||
}, | ||
"json": { | ||
"customer": { | ||
"email": "[email protected]", | ||
"id": 1231231.0, | ||
"name": "Jane Doe" | ||
} | ||
}, | ||
"method": "POST", | ||
"origin": "79.202.43.240", | ||
"url": "https://httpbin.org/anything?q=test&priority=12" | ||
}, | ||
"headers": { | ||
"access-control-allow-credentials": "true", | ||
"access-control-allow-origin": "*", | ||
"connection": "keep-alive", | ||
"content-length": 733, | ||
"content-type": "application/json", | ||
"date": "Tue, 15 Mar 2022 21:31:20 GMT", | ||
"server": "gunicorn/19.9.0" | ||
}, | ||
"status": 200 | ||
} | ||
``` | ||
|
||
### Input (Basic) | ||
|
||
```json | ||
{ | ||
"method": "get", | ||
"url": "https://httpbin.org/basic-auth/user/password", | ||
"authentication": { | ||
"type": "basic", | ||
"username": "{{ "{{secrets.USERNAME}}" }}", | ||
"password": "{{ "{{secrets.PASSWORD}}" }}" | ||
} | ||
} | ||
``` | ||
|
||
### Output (Bearer Token) | ||
|
||
```json | ||
{ | ||
"method": "get", | ||
"url": "https://httpbin.org/bearer", | ||
"authentication": { | ||
"type": "bearer", | ||
"token": "{{ "{{secrets.TOKEN}}" }}" | ||
} | ||
} | ||
``` | ||
|
||
### Input (OAuth 2.0) | ||
|
||
```json | ||
{ | ||
"method": "post", | ||
"url": "https://youroauthclientdomainname.eu.auth0.com/oauth/token", | ||
"authentication": { | ||
"oauthTokenEndpoint":"{{ "{{secrets.OAUTH_TOKEN_ENDPOINT_KEY}}" }}", | ||
"scopes": "read:clients read:users", | ||
"audience":"{{ "{{secrets.AUDIENCE_KEY}}" }}", | ||
"clientId":"{{ "{{secrets.CLIENT_ID_KEY}}" }}", | ||
"clientSecret":"{{ "{{secrets.CLIENT_SECRET_KEY}}" }}", | ||
"type": "oauth-client-credentials-flow", | ||
"clientAuthentication":"{{ "{{secrets.CLIENT_AUTHENTICATION_KEY}}" }}" | ||
} | ||
} | ||
``` | ||
|
||
### Output (Access Token) | ||
|
||
```json | ||
{ | ||
"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlUtN2N6WG1sMzljUFNfUnlQQkNMWCJ9.kjhwfjkhfejkrhfbwjkfbhetcetc", | ||
"scope":"read:clients create:users", | ||
"expires_in":86400, | ||
"token_type":"Bearer" | ||
} | ||
``` | ||
### Error codes | ||
|
||
The Connector will fail on any non-2XX HTTP status code in the response. This error status code will be passed on as error code, e.g. "404". | ||
|
||
## :lock: Use proxy-mechanism | ||
|
||
> :warning: Proxy mode is currently only supported in Camunda 8 SaaS environment. | ||
|
||
You can configure the HTTP JSON Connector to do any outgoing HTTP call via a proxy. This proxy should be effectively also an HTTP JSON Connector | ||
running in a different environment. | ||
|
||
For example, you can build the following runtime architecture: | ||
|
||
``` | ||
Camunda Process --> HTTP Connector (Proxy-mode) --> HTTP Connector --> Endpoint | ||
[ Camunda Network, e.g. K8S ] [ Separate network, e.g. Google Function ] | ||
``` | ||
|
||
Now, any call via the Http Connector will be just forwarded to a specified hardcoded URL. And this proxy does the real call then. | ||
This avoids that you could reach internal endpoints in your Camunda network (e.g. the current Kubernetes cluster). | ||
|
||
Just set the following property to enable proxy mode for the connector, e.g. in application.properties when using the Spring-based runtime: | ||
|
||
```properties | ||
camunda.connector.http.proxy.url=https://someUrl/ | ||
``` | ||
|
||
You can also set this via environment variables: | ||
|
||
``` | ||
CAMUNDA_CONNECTOR_HTTP_PROXY_URL=https://someUrl/ | ||
``` | ||
|
||
If the other party requiring OAuth for authentication, you need to set the following environment property: | ||
|
||
```shell | ||
GOOGLE_APPLICATION_CREDENTIALS=... | ||
``` | ||
|
||
### :lock: Test the Connector locally with Google Cloud Function as a proxy | ||
|
||
Run the [:lock:connector-proxy-saas](https://github.com/camunda/connector-proxy-saas) project locally as described in its [:lock:README](https://github.com/camunda/connector-proxy-saas#usage). | ||
|
||
Set the specific property or environment variable to enable proxy mode as described above. | ||
|
||
## Element Template | ||
|
||
This Connector is a **Protocol Connector**. It is used by multiple out-of-the-box Connector templates. | ||
|
||
The generic HTTP JSON Connector element template can be found in | ||
the [element-templates/http-json-connector.json](element-templates/http-json-connector.json) file. | ||
|
||
Additional Connector templates based on the HTTP JSON Connector: | ||
- [Automation Anywhere Connector](../automation-anywhere) | ||
- [Blue Prism Connector](../blue-prism) | ||
- [UiPath Connector](../uipath) | ||
|
||
|
||
## Properties | ||
{{ props([properties["method"],properties["url"]]) }} | ||
|
||
## Result | ||
The following json structure will be returned by the Connector and can be | ||
used in the result expression. | ||
|
||
```json | ||
{{ exampleData["basic"].json }} | ||
|
||
``` | ||
|
||
The body can be accessed via FEEL: | ||
```json | ||
{{ exampleData["basic"].feel }} | ||
|
||
``` | ||
leading to the following result | ||
```json | ||
{{ exampleData["basic"].feelResultJson }} | ||
|
||
``` | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.