Table of Contents |
---|
Environment variable file path
Case 1: If the user provided an environment variable file path.
Consider this path as example: (lambda-demo/EnvironmentFile/lambda-demo.json)
...
Note: While doing the pattern match for the file, in case more than one file is found then we are throwing the exception with the message: More than one environment Variable file present.
Case 2: If no file path is given or the value of the file path is “NA”
Printing the message: LOG.logInfo(methodName, "Environment variable file path not provided or file path value is set as NA"); and continue the execution and check the input argument for environment variables.
Example of Artifact directory, here we have both environment file and function code in our Artifact directory.
...
Artifact File Path ( Applicable only for local archive )
Case 1: If the user provided an Artifact file path.
Consider this path as example: ( lambda-demo/FunctionCode/lambda-demo.zip )
...
After performing the above steps if we don’t get the file on the given path then we are throwing an exception, with the error message: "No zip file is found on given path:"
Case 2: If the user is not provided a path
If the user is not provided a path, then we are searching the Artifact directory for the file with the ‘zip’ extension and using that file to deploy the lambda function. In case more than one file is present we are throwing an exception.
...
Artifact file path: FunctionCode/lambda-demo.zip
...
Extracted zip file:
...
Function Name ( Add environment variable operation )
[ Priority : user-provided function name > extract name of the file from the env file path and use it as function name ]
...
If the function name and environment variable file path both are not given in that case, we are throwing an exception with the error message: "Failed to retrieve the function name."
Function Name ( Update function code operation )
[ Priority : user-provided function name > ECR image name > S3 key name > extract file name from local archive path ]
...
If the ECR option is not given then check S3 option and if it’s given, then use the name of the S3 key as the function name.
If Both ECR/S3 option is not given then name of the local archive fill be use as function name.
Deployment Type
If the Amazon ECR option is given, then give priority to ECR. [ deploymentType = ECR ]
If ECR URL detail is not given then check S3 details, in case of S3, both the bucket name and the key name are required, in case one of the bucket/key name is missing then throw an exception with the error message: "To update the function code using S3, both S3 Bucket and S3 key name are required." [ deploymentType = S3 ]
If ECR/S3 detail is not given, then by default deployment type is set to local. [ deploymentType = LOCAL ]
...