Whatever message this page gives is out now! Go check it out!
service=getCloudService(cloudCred,cloudConfig)lambdaObject= getCloudService(lambdaCred, lambdaConf)component
{
void function onApplicationStart(){
application.awsCred = {
"alias" : "simple_lambda",
"vendorName" : "AWS",
"region" : "us-east-1",
"secretAccessKey" : "xxxxxxxxxxxxxxxxx",
"accessKeyId" : "xxxxxxxxxxxxxxxx"
}
application.lambdaConf = {
"serviceName" : "LAMBDA"
}
}
}lambdaObject = getCloudService(application.awsCred, application.lambdaConf)<cfscript>
// define the credential and the configuration aliases in the ColdFusion Admin
lambda=cloudService(awsCred,lambdaConf)
// code below.
...........
</cfscript><cfscript>
// Using credential alias and struct for service config
lambdaConf = {
"alias":"simple_lambda",
"serviceName" : "LAMBDA",
"clientOverrideConfig":{
"retryPolicy":{
"numRetries":4
}
},
"httpClientConfig":{
"maxConnections":50
}
}
lambdaObject= cloudService("awsCred", lambdaConf)
// code below
.....................
</cfscript><cfscript>
// Using config alias and struct for service credentials
lambdaCred={
"vendorName":"AWS",
"alias": "lambda_cred_alias",
"region":"us-east-2",
"accessKeyId": "access key",
"secretAccessKey": "secret access"
}
lambdaObject = cloudService(lambdaCred, "lambdaConf")
// code below
.....................................
</cfscript><cfscript>
// Using Structs for both cloud credential and config
lambdaCred={
"vendorName":"AWS",
"alias": "lambda_cred_alias",
"region":"us-east-2",
"accessKeyId": "access key",
"secretAccessKey": "secret access key"
}
lambdaConf = {
"alias":"lambda_conf_alias",
"serviceName" : "LAMBDA",
"clientOverrideConfig":{
"retryPolicy":{
"numRetries":4
}
},
"httpClientConfig":{
"maxConnections":50
}
}
lambdaObject = cloudService(lambdaCred, lambdaConf )
// code below
...................................................................
</cfscript><cfscript>
// Create an object of administrator component and call the login method
adminObj = createObject("component","cfide.adminapi.administrator")
adminObj.login("admin")
// Create an object of cloud component
cloudObj = createObject("component","cfide.adminapi.cloud")
// define credentials struct
credentialStruct={
"alias" : "LambdaCredential",
"vendorName" : "AWS",
"region" : "us-east-2",
"secretAccessKey" : "secret access key",
"accessKeyId" : "access key"
}
// add credential credentialStruct
try{
cloudObj.addCredential(credentialStruct)
writeOutput("Credentials added successfully")
}
catch(any e){
writeDump(e)
}
</cfscript><cfscript>
// Create an object of administrator component and call the login method
adminObj = createObject("component","cfide.adminapi.administrator")
adminObj.login("admin")
// Create an object of cloud component
cloudObj = createObject("component","cfide.adminapi.cloud")
// define configuration struct
configStruct={
"alias":"LambdaConf",
"serviceName":"LAMBDA",
"clientOverrideConfig":{
"retryPolicy":{
"numRetries":4
}
},
"httpClientConfig":{
"maxConnections":50
}
}
// add config configStruct
try{
cloudObj.addServiceConfig(configStruct)
writeOutput("Configuration service added successfully")
}
catch(any e){
writeDump(e)
}
</cfscript>Parameter | Description |
masterRegion | The AWS region of the master functions. If specified, you must set FunctionVersion to ALL. |
functionVersion | Set to ALL to include entries for all published versions of each function. |
marker | Defines the token for pagination to return the next page of results. |
maxItems | The maximum number of functions to return in the response. |
<cfscript>
lambdaSrv = getCloudService(credentialsStruct, confStruct)
// params = StructNew();
functionsList = lambdaSrv.ListFunctions()
writeDump(functionsList)
</cfscript>Parameter | Description |
payload | Input JSON to the Lambda function. |
invocationType | Choose one of the following:
|
logType | Include the execution log in the response. Choose either None or Tail . |
clientContext | Base64-encoded data to pass in the function. The size limit is 3583 bytes. |
<cfscript>
lambdaSrv = getCloudService(credentialsStruct, confStruct)
lambdaFunctionARN = "lambda-function-name|ARN|partialARN"
requestOptions = {
"InvocationType" = "RequestResponse|Event|DryRun"
"LogType" = "Tail|None",
"PayLoad" = "{Event-JSON-str}"
}
responseStatus = lambdaSrv.InvokeFunction(lambdaFunctionARN, requestOptions)
</cfscript>