Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 6886122

Browse files
authored
Merge pull request #25 from triggermesh/readme-update
Events wrapping added to the Readme
2 parents 525a147 + 074a9be commit 6886122

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,58 @@ curl lambda-cpp.default.k.triggermesh.io --data '{"payload": "foobar"}'
124124
Hello, World!
125125
```
126126

127+
## Events wrapping
127128

128-
### Support
129+
Triggermesh AWS custom runtime supports events wrapping for better interoperability of functions and data originated from or targeted at the different platforms. Currently, there are two events wrapper available besides the default "passthrough" one:
130+
131+
- API Gateway wrapper ensures that HTTP requests are digestible by the AWS Lambda functions and decodes their responses to the simple readable format
132+
- CloudEvents wrapper converts function responses into [CloudEvents](https://github.com/cloudevents/spec/blob/v1.0/README.md) event objects.
133+
134+
Events wrapper can be enabled by setting function's environment variables and may have different set of configurable parameters. Let's take a look at CloudEvens example:
135+
136+
1. Generate sample Go function using [tm](https://github.com/triggermesh/tm) CLI
137+
```
138+
tm generate go
139+
```
140+
141+
1. Open go/serverless.yaml deployment manifest and add events wrapper env variables:
142+
```
143+
...
144+
environment:
145+
RESPONSE_WRAPPER: CLOUDEVENTS
146+
CE_TYPE: go-klr-cloudevent
147+
...
148+
```
149+
1. Deploy function:
150+
```
151+
tm deploy -f go --wait
152+
```
153+
154+
After CLI report that deployment is succeeded, send a request to the function endpoint:
155+
156+
```
157+
curl -d '{"Name":"Joe"}' https://go-demo-service-go-function.default.dev.munu.io
158+
```
159+
160+
The result will be encoded into CloudEvents format:
161+
162+
```
163+
Validation: valid
164+
Context Attributes,
165+
specversion: 1.0
166+
type: go-klr-cloudevent
167+
source: go-demo-service-go-function
168+
subject: klr-response
169+
id: 7fa17c84-56f0-488a-b7de-e45d7fb3b7b1
170+
datacontenttype: application/json
171+
Data (binary),
172+
"Hello Joe!"
173+
```
174+
175+
## Support
129176

130177
We would love your feedback on this tool so don't hesitate to let us know what is wrong and how we could improve it, just file an [issue](https://github.com/triggermesh/aws-custom-runtime/issues/new)
131178

132-
### Code of Conduct
179+
## Code of Conduct
133180

134181
This plugin is by no means part of [CNCF](https://www.cncf.io/) but we abide by its [code of conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md)

0 commit comments

Comments
 (0)