1
00:00:00,210 --> 00:00:07,230
In this video, we are going to start developing our lambda function code according to HTTP, get incoming

2
00:00:07,230 --> 00:00:09,180
events from the Amazon API gateway.

3
00:00:09,420 --> 00:00:16,530
So let's open the Visual Studio code and let's focus on the get and get buy ID request, which comes

4
00:00:16,530 --> 00:00:19,320
from the API gateway in the gate request.

5
00:00:19,320 --> 00:00:22,650
We have a resource path and a HTTP method.

6
00:00:22,680 --> 00:00:26,940
These are the important attributes and get by ID.

7
00:00:27,790 --> 00:00:28,540
Jason Pyle.

8
00:00:28,540 --> 00:00:33,640
Again, the important attributes are resource, pet and method.

9
00:00:33,640 --> 00:00:39,850
But this time if there is a pet parameters, if you scroll down, we can see additional attributes,

10
00:00:39,850 --> 00:00:44,140
which is the pet parameters and giving the ID and volume information.

11
00:00:44,350 --> 00:00:50,920
So we should check the pet parameters for the get by ID event and otherwise we should only check for

12
00:00:50,920 --> 00:00:54,660
the estimated get for the gate JSON object.

13
00:00:54,670 --> 00:01:02,200
So according to this assumption, let's develop our actual lambda function, go to index and we will

14
00:01:02,200 --> 00:01:04,270
implement these to this statement.

15
00:01:04,600 --> 00:01:10,240
So according to incoming event, we basically check the event estimated for that purpose, we will write

16
00:01:10,240 --> 00:01:11,410
a switch statement.

17
00:01:11,440 --> 00:01:13,960
Let me write first and explain after that.

18
00:01:13,990 --> 00:01:16,600
Let me start with the switch statement.

19
00:01:16,630 --> 00:01:22,430
If you look at the switch statement, it is the condition is the event that HDV method.

20
00:01:22,450 --> 00:01:26,730
So that means every incoming event starting with the active method.

21
00:01:26,740 --> 00:01:34,070
So that's why we can check the HTTP method of the incoming event json object.

22
00:01:34,090 --> 00:01:37,570
This will be the get post put on the IT operation.

23
00:01:37,690 --> 00:01:44,230
And after that we will check that if there is a get request, we have one if condition which is looking

24
00:01:44,230 --> 00:01:45,450
to patch parameters.

25
00:01:45,460 --> 00:01:50,290
If there is a pet parameters, that means it comes from the get by ID request.

26
00:01:50,290 --> 00:01:54,970
And after that we will check the pet parameters and get the ID information.

27
00:01:55,000 --> 00:02:02,410
If you look at the indexes, we basically get the ID value in here and passing these value to the get

28
00:02:02,410 --> 00:02:07,240
product method that we will be develop implement this method in the upcoming videos.

29
00:02:07,240 --> 00:02:14,170
But after the if statement, there is a s block which is basically get all products because if there

30
00:02:14,170 --> 00:02:21,880
is there is no any pet parameters, that means get all product requests coming from the Amazon API gateway.

31
00:02:21,880 --> 00:02:27,950
And so that's why we will design our switch statement to get all products.

32
00:02:27,970 --> 00:02:31,900
As you can see that there is a two method that we didn't implement yet.

33
00:02:31,930 --> 00:02:37,000
We will implement these methods in the upcoming videos, but before that we should design our switch

34
00:02:37,000 --> 00:02:41,080
statement and understand and accommodate incoming event JSON object.

35
00:02:41,680 --> 00:02:49,420
So if you go to the API gateway console, you can also see that in here, we basically accommodate this

36
00:02:49,420 --> 00:02:52,900
get request and also this get by idea request.

37
00:02:53,150 --> 00:03:00,790
Okay, now it is time to implement our get and get by ideologic into our index case file.

38
00:03:00,790 --> 00:03:05,440
So in the next video we will start with the get product method.
