Name | Default | Description |
---|---|---|
VERBOSE |
true |
if true you get an extensive log output |
REQUEST_TEMPLATE |
Go template for the transformation of the incoming event to a HTTP-Request in form of RFC2616. Payload of the incoming event is available under data . |
|
RESPONSE_TEMPLATE |
`{{ .httpresponse.body | toJson }}` |
HTTP_JSON_BODY |
true |
if true marshalls the response payload to a data structure available as httpresponse.body |
CE_SOURCE |
https://github.com/alitari/ce-go-template |
Cloudevent Source |
CE_TYPE |
com.github.alitari.ce-go-template.mapper |
Cloudevent Type |
K_SINK |
An adressable K8s resource. see Sinkbinding | |
CE_PORT |
8080 |
server port |
inputce
: payload of the incoming eventhttpresponse.header
: response headerhttpresponse.status
: response statushttpresponse.statusCode
: response status code as inthttpresponse.body
: response body as struct if payload is json andHTTP_JSON_BODY
is true, string otherwise
REQUEST_TEMPLATE="GET https://api.genderize.io?name={{ .data.name }} HTTP/1.1"$'\n'"content-type: application/json"$'\n'$'\n' \
RESPONSE_TEMPLATE='{ "name": {{ .inputce.data.name | quote }}, "gender": {{ .httpresponse.body.gender | quote }} }' go run cmd/http-client-mapper/main.go
# in a new shell
http POST localhost:8080 "content-type: application/json" "ce-specversion: 1.0" "ce-source: http-command" "ce-type: example" "ce-id: 123-abc" name=Daniela