本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
sam 本地 generate-event
从不同的事件源(如 Amazon S3、Amazon API Gateway 和 Amazon SNS)生成示例负载。这些负载包含事件源发送到 Lambda 函数的信息。
用量:
sam local generate-event [OPTIONS] COMMAND [ARGS]...
示例:
Generate the event that S3 sends to your Lambda function when a new object is uploaded sam local generate-event s3 [put/delete] # You can even customize the event by adding parameter flags. To find which flags apply to your command, run: sam local generate-event s3 [put/delete] --help # Then you can add in those flags that you wish to customize using sam local generate-event s3 [put/delete] --bucket <bucket> --key <key> # After you generate a sample event, you can use it to test your Lambda function locally sam local generate-event s3 [put/delete] --bucket <bucket> --key <key> | sam local invoke -e - <function logical id>
选项:
选项 | 描述 |
---|---|
--config-file PATH |
包含要使用的默认参数值的配置文件的路径和文件名。默认值为项目根目录中的“samconfig.toml”。有关配置文件的详细信息,请参阅 AWS SAM CLI 配置文件。 |
--config-env TEXT |
配置文件中指定要使用的默认参数值的环境名称。默认值为“default”。有关配置文件的详细信息,请参阅 AWS SAM CLI 配置文件。 |
--help |
显示此消息并退出。 |
命令:
-
alexa-skills-kit
-
alexa-smart-home
-
apigateway
-
batch
-
cloudformation
-
cloudfront
-
cloudwatch
-
codecommit
-
codepipeline
-
cognito
-
config
-
dynamodb
-
kinesis
-
lex
-
rekognition
-
s3
-
ses
-
sns
-
sqs
-
stepfunctions