1
00:00:00,150 --> 00:00:07,170
In this video, we are going to develop put events on Amazon event using the SDK libraries.

2
00:00:07,350 --> 00:00:12,450
You can see the image we are in the first use case, which is the events in Amazon Event Village and

3
00:00:12,450 --> 00:00:17,910
we will perform these use case with using the Amazon event SDK package.

4
00:00:17,940 --> 00:00:25,500
If you go to the documentation, we can see that in the event which client library we will use a SDK

5
00:00:25,500 --> 00:00:30,810
JavaScript event, which client library and you can scroll down, you can see that how we can install

6
00:00:30,810 --> 00:00:35,410
and how we can import and use this library in order to interact with the event page.

7
00:00:35,430 --> 00:00:37,140
So let's get started.

8
00:00:37,500 --> 00:00:43,830
I'm going to create a separate lecture and section folder into our pseudocode, and here you can find

9
00:00:43,830 --> 00:00:44,880
the our steps.

10
00:00:44,880 --> 00:00:46,260
We will use these commands.

11
00:00:46,260 --> 00:00:51,870
And first of all, we should create a Node.js application with creating package JSON file.

12
00:00:51,870 --> 00:00:57,300
And after that we will install the required event package in order to interact with the event page.

13
00:00:57,300 --> 00:01:04,530
For that purpose, please open the terminal and go to locate project folder of the section.

14
00:01:04,620 --> 00:01:10,710
This is a section 42 and lecture is event page.

15
00:01:10,710 --> 00:01:15,330
Okay, now I am going to copy this NPM command and hit enter.

16
00:01:15,540 --> 00:01:22,230
And first of all we have create a package JSON file and the first thing we should do that is set a type

17
00:01:22,230 --> 00:01:28,110
as a module in order to gain a script six standard, please save the package JSON file, come back to

18
00:01:28,110 --> 00:01:33,930
commands and copy paste from the second command which is the installer required NPM package for the

19
00:01:33,930 --> 00:01:35,790
event bridge SDK Library.

20
00:01:38,700 --> 00:01:39,510
Okay.

21
00:01:39,540 --> 00:01:45,740
This will take some time to install required SDK package and yes, it is created successfully.

22
00:01:45,990 --> 00:01:48,330
Modules are created and also package JSON file.

23
00:01:48,330 --> 00:01:51,030
If you scroll down, you can see the dependencies.

24
00:01:51,060 --> 00:01:57,090
Now we are going to start implementation so I can close this window.

25
00:01:57,090 --> 00:02:03,480
And now as you can see that the first thing we should create a client object in the Node.js module to

26
00:02:03,480 --> 00:02:05,430
interact with the event API.

27
00:02:05,430 --> 00:02:13,110
So for that purpose I'm going to create a new file which is the event client JavaScript.

28
00:02:13,230 --> 00:02:22,530
So if you create a new JavaScript file, basically we will create an event with each client in order

29
00:02:22,530 --> 00:02:23,750
to interact with event page.

30
00:02:23,760 --> 00:02:31,500
And this is the best practice when we are using these operations, see that we have created using the

31
00:02:31,500 --> 00:02:39,060
event client object and we have created new object and we are exporting EB client for event operation.

32
00:02:39,060 --> 00:02:40,350
Click Save this file.

33
00:02:40,380 --> 00:02:45,480
And after that, if you come back to our common text, basically we will start the implementation,

34
00:02:45,480 --> 00:02:47,880
put event command in order to do it.

35
00:02:47,880 --> 00:02:55,200
I'm going to create a need your secret file, which is a put event, but JS And in this file we will

36
00:02:55,200 --> 00:02:56,790
implement these put event command.

37
00:02:56,790 --> 00:03:00,000
But before that let's review and check the documentation.

38
00:03:00,000 --> 00:03:06,420
So if you open the documentation again and in the right hand side, you can search for the commands.

39
00:03:06,450 --> 00:03:11,850
As I put event commands, go to put event commands and see the details and see the example usage.

40
00:03:11,850 --> 00:03:17,220
We should import required command and client object and after that we will send the command in here

41
00:03:17,220 --> 00:03:19,020
to see input and outputs.

42
00:03:19,020 --> 00:03:21,720
I'm going to open the put events command input.

43
00:03:21,720 --> 00:03:28,560
The properties is expecting entities and also the output is returned back to entries and failed entry

44
00:03:28,560 --> 00:03:29,110
count.

45
00:03:29,160 --> 00:03:32,010
Okay, now let's start the implementation on Visual Studio code.

46
00:03:32,010 --> 00:03:34,650
Please open the visual code and start implementation.

47
00:03:34,650 --> 00:03:40,530
If you open the input event that JS file, I have developed the required codes you can see in here.

48
00:03:40,530 --> 00:03:45,750
Basically this is very similar what we have done in the previous interactions with the SDK.

49
00:03:45,780 --> 00:03:50,910
The first two import statements regarding to client event which we will use put events command.

50
00:03:50,910 --> 00:03:54,810
And here you can see the EB client for interaction for event bridge.

51
00:03:54,810 --> 00:03:59,850
So after that we provide the parameters for the event commands in the parameters as you remember that

52
00:03:59,850 --> 00:04:07,230
we have entities array and every array has the type of the detail, tail type and source of the event.

53
00:04:07,230 --> 00:04:12,000
I have put here some of the random values for the detail, detail type and the source.

54
00:04:12,000 --> 00:04:17,370
And after that you can see the our actual run method that we are going to interact with the event bridge.

55
00:04:17,370 --> 00:04:24,000
So basically we will use event sent to send put event codes with passing these parameters and this will

56
00:04:24,000 --> 00:04:27,450
be put event to our event page, which is the default event.

57
00:04:27,450 --> 00:04:34,700
Plus in order to test this function, you can come to terminal and run the node command, not put event.

58
00:04:34,830 --> 00:04:39,930
JS If you hit the enter, this will be put event to the default event pass.

59
00:04:39,930 --> 00:04:45,570
You can see the service goes to 100 and if you scroll down you can see the entries and the event ID

60
00:04:45,570 --> 00:04:46,800
is created successfully.
