AWS Lambda
Use the AWS Lambda policy to invoke an AWS Lambda function.
In IBM API Studio, this policy
is identified by the kind InvokeAWSLambda.
Example of an AWS Lambda policy in code view.
kind: InvokeAWSLambda
apiVersion: api.ibm.com/v1
metadata:
name: AWSLambdaExtension
version: 1
namespace: sample
spec:
functionName: test
qualifier: v1 # version of a function name
invocationType: request-response #invocation type - request-response or event
region: aws-us
awsAuthType:
accessSecret: my-aws-secret
tlsConnectionProfile: my-aws-con-alias
input: inputMessage #optional
output: outputMessage #optional
clientConfig:
# Timeouts (in milliseconds)
socketTimeout: 1000
connectionTimeout: 1000
requestTimeout: 1000
clientExecutionTimeout: 1000
clientRetryCount: 5
connectionExpirationTimeout: 100
enableExpectContinue: true
enableGzip: true
enableHostPrefixInjection: true
maxConnectionIdleTime: 1000
responseMetadataCacheSize: 128
# Retry settings
enableThrottledRetries: true
# Connection settings
enableKeepAlive: true
enableResponseMetadataCache: true
signatureAlgorithm: test
tcpSendBufferSizeHint: 10
tcpReceiveBufferSizeHint: 10
extensions:
dp-nano-gateway:
apiVersion: api.ibm.com/v1
spec:
clientConfig:
serverRetryCount: 3
webm-gateway:
apiVersion: api.ibm.com/v1
spec:
condition: (${request.httpMethod} equals POST) or (${request.headers.name} notEquals ${request.payload.jsonPath[$.customer.name]})
lambdaConfig:
alias: test
clientConfig:
retryOnErrorCount: 1
request_processing:
transformations:
set:
- key: ${request.headers.h2}
value: test4
- key: ${request.query.q2}
value: ${request.payload.jsonPath[$.customer.name]}
setPayload:
content-types:
- application/json: |
{"empid" : "1"}
- application/xml: |
<a>a<a>
- text/plain: |
sample text
defaultContentType: application/json
xsl:
- feature:
- name: http://javax.xml.XMLConstants/feature/secure-processing
value: true
$path: ./a/a.xsl
content: sdsd
remove:
- ${request.query.q1}
- ${request.path}
useIncomingHeaders: true
response_processing:
transformations:
set:
- key: ${request.headers.h2}
value: test4
- key: ${request.query.q2}
value: ${request.payload.jsonPath[$.customer.name]}
copyEntireResponse: true
abortAPIExecutionForFailure: true
namespaces:
- prefix: ps1
URI: http://test.com
- prefix: ps2
URI: http://test2.com
InvokeAWSLambda policy kind, configure these specifications:| Code view | Form view | Description |
|---|---|---|
condition |
Conditions |
Conditions are used to specify when the policy is run. You can add multiple conditions with logical operators. Provide the condition in the format: {set} operator {value} condition {set} operator {value} You can configure the following conditions:
You can use the following operators in the code view and in the form view by using the Add condition button, which is optional.
|
lambdaConfig |
AWS Lambda |
Configures the messaging system details such as connection, destination, and message format.
Define these Lambda configurations after specifying the Function name:
|
request_processing |
Request transformation |
Specifies the request processing parameters. You can configure the following
|
response_processing |
Response processing |
Specifies the response processing parameters.
|
namespaces |
Namespace |
Configure the metadata for the message configuration request. In the code view, under In the form view, use the Custom metadata extension tab to configure the metadata. Click the Add namespace button for this configuration and specify the Namespace prefix and Namespace URL, which are both optional fields. |