Skip to content

Commit

Permalink
feat(lambda-trigger): expose Lambda invocation type. Closes: #994 (#1187
Browse files Browse the repository at this point in the history
)

* feat(lambda-trigger): expose Lambda invocation type. Closes: #994

Signed-off-by: Derek Wang <whynowy@gmail.com>

* example

Signed-off-by: Derek Wang <whynowy@gmail.com>
  • Loading branch information
whynowy committed Apr 23, 2021
1 parent 79cae5c commit c71d10d
Show file tree
Hide file tree
Showing 10 changed files with 410 additions and 244 deletions.
6 changes: 6 additions & 0 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions api/sensor.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions api/sensor.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions examples/sensors/aws-lambda-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ spec:
dependencyName: test-dep
dataKey: body.name
dest: name
# Optional, possible values: RequestResponse, Event and DryRun
# Defaults to RequestResponse, which means invoke the function synchronously.
invocationType: Event
522 changes: 284 additions & 238 deletions pkg/apis/sensor/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions pkg/apis/sensor/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions pkg/apis/sensor/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions pkg/apis/sensor/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,25 @@ type AWSLambdaTrigger struct {
// Region is AWS region
Region string `json:"region" protobuf:"bytes,4,opt,name=region"`
// Payload is the list of key-value extracted from an event payload to construct the request payload.

Payload []TriggerParameter `json:"payload" protobuf:"bytes,5,rep,name=payload"`
// Parameters is the list of key-value extracted from event's payload that are applied to
// the trigger resource.

// +optional
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,6,rep,name=parameters"`
// Choose from the following options.
//
// * RequestResponse (default) - Invoke the function synchronously. Keep
// the connection open until the function returns a response or times out.
// The API response includes the function response and additional data.
//
// * Event - Invoke the function asynchronously. Send events that fail multiple
// times to the function's dead-letter queue (if it's configured). The API
// response only includes a status code.
//
// * DryRun - Validate parameter values and verify that the user or role
// has permission to invoke the function.
// +optional
InvocationType *string `json:"invocationType,omitempty" protobuf:"bytes,7,opt,name=invocationType"`
}

// AzureEventHubsTrigger refers to specification of the Azure Event Hubs Trigger
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/sensor/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions sensors/triggers/aws-lambda/aws-lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ func (t *AWSLambdaTrigger) Execute(ctx context.Context, events map[string]*v1alp
}

response, err := t.LambdaClient.Invoke(&lambda.InvokeInput{
FunctionName: &trigger.FunctionName,
Payload: payload,
FunctionName: &trigger.FunctionName,
Payload: payload,
InvocationType: trigger.InvocationType,
})
if err != nil {
return nil, err
Expand Down

0 comments on commit c71d10d

Please sign in to comment.