Skip to Content
全栈Serverless
book

全栈Serverless

by Nader Dabit
March 2022
Intermediate to advanced
205 pages
3h 9m
Chinese
China Electric Power Press Ltd.
Content preview from 全栈Serverless
100
|
第
6
章
在第
7
章中,我们将通过创建一个电子商务应用程序来继续学习无服务器函
数,该应用程序会与数据库进行交互,并允许用户通过
API
实现调用,创建,
读取,更新和删除数据库中的项目。
6.1
事件源和数据结构
在第二章中,我们简要介绍了无服务器函数的事件源,它是基于事件体系结
构的一部分。到目前为止,我们唯一实现的事件源来自
API Gateway:
触发该
函数的
HTTP
请求,从
API
提取数据并返回响应。在本章中,我们将使用其
他两种事件源,一种来自
Amazone S3
,另一种来自
Amazon Cognito
。
为了理解从事件源传入
Lambda
的事件,有必要强调以下一点
:
事件数据的特
征在不同的事件类型之间是不同的。例如,来自
API Gateway
的
HTTP
事件
数据结构与
Amazon S3
的事件数据结构不同,并且
Amazon S3
的事件数据结
构与
Amazon Cognito
的数据结构不同。
了解事件数据的特征以及事件中可用的数据,将有助于你了解
Lambda
函数
的功能。为了更好地理解这一点,让我们来看一下不同事件的数据结构的特征。
现在,你无需了解这些数据结构中的每个字段和值。在以下示例中,将简要
介绍一些关键的参数值。
6.1.1 API Gateway
事件
API
网关事件数据是从
API Gateway HTTP
事件(例如
GET
,
PUT
,
POST
或
DELETE
)调用时将传递给
Lambda
函数的数据结构。此数据结构包含
信息,例如调用该函数的
HTTP
方法,调用路径,传入的主体
(
如果有的
话
)
,如果用户通过了身份验证,还包括用户调用 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
Python实用技能学习指南

Python实用技能学习指南

Posts & Telecom Press, Robert Smallshire, Austin Bingham
流架构

流架构

James Urquhart

Publisher Resources

ISBN: 9787519864453