Skip to content

Commit 31cf96d

Browse files
author
Jeremiah Langner
committed
feat(dynamodb): add full response example for dynamodb custom response
1 parent 24aa555 commit 31cf96d

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,7 @@ custom:
594594
template:
595595
# `success` is used when the integration response is 200
596596
success: |-
597-
#set($item = $input.path('$.Item'))
598-
{ "Item": $item }
597+
#set($item = $input.path('$.Item')){ "Item": $item }
599598
# `clientError` is used when the integration response is 400
600599
clientError: |-
601600
{ "message": "there is an error in your request" }
@@ -604,6 +603,36 @@ custom:
604603
{ "message": "there was an error handling your request" }
605604
```
606605
606+
##### Full response customization
607+
608+
If you want more control over the integration response, you can
609+
provide an array of objects for the `response` value:
610+
611+
```yml
612+
custom:
613+
apiGatewayServiceProxies:
614+
- dynamodb:
615+
path: /dynamodb
616+
method: get
617+
tableName: { Ref: 'YourTable' }
618+
hashKey:
619+
queryStringParam: id # use query string parameter
620+
attributeType: S
621+
rangeKey:
622+
queryStringParam: sort
623+
attributeType: S
624+
action: GetItem
625+
cors: true
626+
response:
627+
- statusCode: 200
628+
selectionPattern: '2\\d{2}'
629+
responseParameters: {}
630+
responseTemplates:
631+
application/json: |-
632+
#set($item = $input.path('$.Item')){ "Item": $item }
633+
634+
```
635+
607636
### EventBridge
608637

609638
Sample syntax for EventBridge proxy in `serverless.yml`.

0 commit comments

Comments
 (0)