Skip to main content
Feedback

Overview of Sample Specifications and API Management Gateway Action

Following table provides sample high level specs between API Management Gateway and AWS Lambda function implementation. Based on agreed integration specs API Management Gateway takes appropriate action.

ConditionApplicabilityConnector Pre/Post Input Configuration DataConnector Constructed JSON Object to Lambda FunctionAWS Lambda Function Response CodeAWS Lambda Function OutputGateway Action

Valid request:

Input Scenario -Synchronicity specified as "request-response"

Output Scenario- Empty response from AWS Lambda

Pre Post

- Synchronicity:request-response

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af", "point" : "PreProcessor/PostProcessor", "synchronicity" : "RequestResponse", "packageKey" : "kxm48rvx9anypbcfq5fyjw5s", "serviceId" : "eq7mxju5k4hvmpzejpzax2ap", "endpointId" : "8xbkgw5q387cs9juushwwrtv", }

200{}Forward client request to target server in case of pre-process. Forward response to user client in case of post-process.

Valid request:

Input Scenario -Synchronicity not specified

Output Scenario - Getting only code in terminate object from AWS Lambda

Pre Post

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af", "point" : "PreProcessor/PostProcessor", "synchronicity" : "RequestResponse", "packageKey" : "kxm48rvx9anypbcfq5fyjw5s", "serviceId" : "eq7mxju5k4hvmpzejpzax2ap", "endpointId" : "8xbkgw5q387cs9juushwwrtv",}

200

{

"terminate" : {

"code" : 403

}}

Block the call and return call to user client. Send error code 403 to the user client with the message

Service cannot be provided, code 0x000003BB

Valid request:

Input Scenario -Incorrect Synchronicity specified 

Output Scenario - Getting code and message in terminate object from AWS

Pre Post

- synchronicity:event

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af", "point" : "PreProcessor/PostProcessor", "synchronicity" : "RequestResponse", "packageKey" : "kxm48rvx9anypbcfq5fyjw5s", "serviceId" : "eq7mxju5k4hvmpzejpzax2ap", "endpointId" : "8xbkgw5q387cs9juushwwrtv",

}

200

{

"terminate" : {

"code" : 400,

"message" : "Bad Request"

}

}

Block the call and return call to user client. Send error code 400 to the user client with the message

Bad Request.

Valid request:

Input Scenario - Synchronicity specified as "event"

Pre Post

- synchronicity:event

- functionARN:arn:aws:lambda:eu-west-1:12345678:function:LambdaBasicAsync

- useAssumeRole:false

- region:eu-west-1

{

"point":"PreProcessor/PostProcessor","masheryMessageId":"c3949ec1-b980-4ee1-b3c5-ce1599435950","serviceId":"9yt9cgmu74rypb8stg5r67hh","packageKey":"b8664brqffa5zbe47hg6p2b3","endpointId":"4xk6dfdx95x7ycj77eeyj6ta","synchronicity":"Event"}

200{}Forward client request to target server in case of pre-process. Forward response to user client in case of post-process.

Valid request:

Input Scenario - Skip Request Header specified and all required headers present in request

Output Scenario - Getting addHeader, payload in modify object from AWS

Pre Post

- synchronicity:request-response

- require-request-headers: Authorization

- include-request-headers: Header1, Header2

- skip-request-headers : Header1, Authorization

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af", "point" : "PreProcessor/PostProcessor", "synchronicity" : "RequestResponse", "packageKey" : "kxm48rvx9anypbcfq5fyjw5s", "serviceId" : "eq7mxju5k4hvmpzejpzax2ap", "endpointId" : "8xbkgw5q387cs9juushwwrtv",

"request": { "headers": { "Header2": "Header2_Value"

}

}

}

200

{

"modify" : {

"payload" : "Custom Payload",

"addHeaders" : {

"x-acme-error" : "B0-932-K"

}

}

Forward the request to target server in case of pre-process and set payload as Custom Payload and add header x-acme-error in the target requestForward the response to user client in case of post-process and set payload as Custom Payload and add header x-acme-error in the response.

Valid request:

Input Scenario - Include Response Header specified and not present in response

Output Scenario - Getting Getting dropHeader, json in modify object from AWS

Post

- include-response-headers: Header1

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af", "point" : "PostProcessor", "synchronicity" : "RequestResponse", "packageKey" : "kxm48rvx9anypbcfq5fyjw5s", "serviceId" : "eq7mxju5k4hvmpzejpzax2ap", "endpointId" : "8xbkgw5q387cs9juushwwrtv"

}

200

{

"modify" : {

"base64Encoded" : true,

"completeWithCode" : 500,

"json" : {

"a" : "b",

"c" : "d"

},

"dropHeaders" :[ "authorization" ] }}

Forward the response to user client and set payload as below value:

{

"a" : "b"

"c" : "d"

}

Add drop header authorization from response and set response code as 500.

Valid request:

Input Scenario - Skip Response Header specified and all required headers present in response

Output Scenario - Getting base64 encoded payload in modify object from AWS

Post

- synchronicity:request-response

- include-response-headers: Header1,Header2

- skip-request-headers : Header1

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af", "point" : "PostProcessor", "synchronicity" : "RequestResponse", "packageKey" : "kxm48rvx9anypbcfq5fyjw5s", "serviceId" : "eq7mxju5k4hvmpzejpzax2ap", "endpointId" : "8xbkgw5q387cs9juushwwrtv",

"response": { "headers": { "Header2": "Header2_Value"

}

}

}

200

{

"modify" : {

"completeWithCode" : 201,

"payload" : "Q3VzdG9tIHBheWxvYWQ="

"base64Encoded" : true

}

}

Forward the response to user client and set payload as Custom Payload and set response code as 201.
Require EAV/Require Package Key EAVs Not PresentPre Post

- synchronicity:request-response

- require-eavs: ApplicationEAV1

- require-packageKey-eavs: PackageKeyEAV1

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

NANANABlock the call and return call to user client. Send error code 400 to the user client with the message RequiredApplicationEAVConditionFailure.
AmazonServiceException like Invalid AWS Credentials with failSafeParameter as TruePre Post

- synchronicity:event

- failSafe:true

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af",

"point" : "PreProcessor",

"synchronicity" : "RequestResponse",

"packageKey" : "kxm48rvx9anypbcfq5fyjw5s",

"serviceId" : "eq7mxju5k4hvmpzejpzax2ap",

"endpointId" : "8xbkgw5q387cs9juushwwrtv"

}

403Error Message : Unauthorized UserNAForward client request to origin server.

Valid request:

Input Scenario - Request payload is smaller than maxPayloadSize but greater than 10KB and request payload is json

Output Scenario - Same Header is specified in dropHeader and addHeaders and completWithCode in modify object from AWS

Pre

- synchronicity:request-response/event

- expand-input : requestPayload

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

- max-payload-size: 20

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af",

"point" : "PreProcessor",

"synchronicity" : "RequestResponse",

"packageKey" : "kxm48rvx9anypbcfq5fyjw5s",

"serviceId" : "eq7mxju5k4hvmpzejpzax2ap",

"endpointId" : "8xbkgw5q387cs9juushwwrtv",

"request" : {

"payloadLength" : 95,

"payload" : "{"stay": {"checkIn": "2016-08-15","checkOut": "2016-08-20","shiftDays": "2"},"dailyRate": true}",

"payloadBase64Encoded" : false

}

}

200

{

"modify" : {

"payload" : "Set replacement payload",

"base64Encoded" : false,

"addHeaders" : {

"x-acme-level" : "44",

"x-acme-bearing" : "326 degrees of inner turbulence"

},

"dropHeaders" : [ "x-acme-level" ],

"completeWithCode": 201

}

}

Send the request to the target server with payload as Set replacement payload and headers x-acme-level and x-acme-bearing added in the request. In case of pre-process, completeWithCode will not be set in the response.

Valid request:

Input Scenario -Max Payload Condition specified but not expand-input and response payload is greater than max payload size

Output Scenario - Exception from AWS

Post

- synchronicity:request-response

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

- max-payload-size: 20

- max-payload-condition: Blocking

- expand-input : responsePayload

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af",

"point" : "PostProcessor",

"synchronicity" : "RequestResponse",

"packageKey" : "kxm48rvx9anypbcfq5fyjw5s",

"serviceId" : "eq7mxju5k4hvmpzejpzax2ap",

"endpointId" : "8xbkgw5q387cs9juushwwrtv",

"response" : {

"payloadLength" : 95,

"payload" : "{"stay": {"checkIn": "2016-08-15","checkOut": "2016-08-20","shiftDays": "2"},"dailyRate": true}",

"payloadBase64Encoded" : false

}}

NANA

Block the call and return call to user client .Send error code 500 to the user client with the message

InvalidResponseFromAWSLambdaInPostProcess(/h1)

Valid request:

Input Scenario -Response payload is greater than max payload size and max payload condition is filtering

Output Scenario - Exception from AWS and failSafe is true in input configuration

Post

- synchronicity:request-response

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

- max-payload-size: 20

- max-payload-condition: Filtering

- expand-input : responsePayload

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af",

"point" : "PostProcessor",

"synchronicity" : "RequestResponse",

"packageKey" : "kxm48rvx9anypbcfq5fyjw5s",

"serviceId" : "eq7mxju5k4hvmpzejpzax2ap",

"endpointId" : "8xbkgw5q387cs9juushwwrtv",

"response" : {

"payloadLength" : 35678,

"payload" : "{"stay": {"checkIn": "2016-08-15","checkOut": "2016-08-20","shiftDays": "2"},"dailyRate": true}",

"payloadBase64Encoded" : false

}

}

NANAForward the call to the target server as failSafe parameter is true.

Valid request:

Input Scenario - ResponsePayload Content-type is not json and responsePayload is less than 10KB

Output Scenario - Amazon Service Exception with status code and message and failSafe as True in input configuration

Pre

- synchronicity:request-response

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

- expand-input : responsePayload

- failSafe: true

{

"masheryMessageId" : "7632924a-8d8d-4d35-8a77-b57c4bb450af",

"point" : "PostProcessor",

"synchronicity" : "RequestResponse",

"packageKey" : "kxm48rvx9anypbcfq5fyjw5s",

"serviceId" : "eq7mxju5k4hvmpzejpzax2ap",

"endpointId" : "8xbkgw5q387cs9juushwwrtv",

"request" : {

"payloadLength" : 95,

"payload" : "{"stay": {"checkIn": "2016-08-15","checkOut": "2016-08-20","shiftDays": "2"},"dailyRate": true}",

"payloadBase64Encoded" : false

}

}

500

Error Message : Invalid AWS Function

NAForward the call to the target server as failSafe parameter is true.

Valid request:

Input Scenario - One of the compulsory parameter (fucntionARN/region/roleArn/externalID) is not specified

Pre Post

- synchronicity:request-response

- functionARN: arn:aws:lambda:us-east-1:12345678:function:orderapi-analytics-sidecar

- roleARN:arn:aws:sts::12345678:role/tibco_sidecar_connector

- region:us-east-1

NANANABlock the call and return call to user client. Send error code 500 to the user client with the message InvalidPreInputConfiguration.

AWS Lambda Sidecar Architecture & Design Guidelines Sidecar Connector Assumed Role Support Lambda Function Input (JSON Specs) For Sidecar Preprocess POST Request Call Lambda Function Input (JSON Specs) For Sidecar Postprocess POST Request Call