1
00:00:00,150 --> 00:00:05,600
In this video, we are going to develop the list bucket command in our Node.js application.

2
00:00:05,610 --> 00:00:12,510
For that purpose, please, we should do a code and create a native JavaScript file, which is the list

3
00:00:12,510 --> 00:00:15,480
bucket that goes into our lecture folder.

4
00:00:15,510 --> 00:00:18,150
And after that please implement these raw method.

5
00:00:18,150 --> 00:00:22,410
This is the boilerplate method we will implement in this video.

6
00:00:22,410 --> 00:00:28,380
So basically we will create a run method, which is the asynchronous method that is using the available

7
00:00:28,380 --> 00:00:34,020
client send method operation to perform S3 interactions for listing bucket.

8
00:00:34,020 --> 00:00:38,520
And after that we will run this method in our JavaScript file.

9
00:00:38,520 --> 00:00:41,030
So let me implement this to do part.

10
00:00:41,040 --> 00:00:47,550
Basically, we will use S3 client object and send the command of the list bucket command.

11
00:00:47,550 --> 00:00:51,360
In order to do that, I'm going to write these two lines of code.

12
00:00:51,360 --> 00:00:52,920
Please save this file.

13
00:00:52,950 --> 00:00:53,930
Of course we should pay.

14
00:00:54,390 --> 00:00:56,250
We should cover the tri cage block.

15
00:00:56,280 --> 00:01:01,740
If there is an error, we should catch these error during the S3 communication.

16
00:01:01,740 --> 00:01:07,380
But the important part is we are using S3 client object and sent to list bucket command.

17
00:01:07,380 --> 00:01:10,530
And this list Bucket Command has no any parameters.

18
00:01:10,530 --> 00:01:13,500
So that's why I didn't create any parameters yet.

19
00:01:13,500 --> 00:01:21,360
And after returning any data, we are listing the buckets, data, bucket, subject and log this operation.

20
00:01:21,420 --> 00:01:28,920
So before running these methods, these JavaScript file, we should record edit the required import

21
00:01:28,920 --> 00:01:31,320
statement into our JavaScript file.

22
00:01:31,320 --> 00:01:33,630
For example, we used list bucket command.

23
00:01:33,630 --> 00:01:39,930
If you come here and click the control space and click this command, this will be import list buckets

24
00:01:39,930 --> 00:01:42,150
command from the client S3 package.

25
00:01:42,150 --> 00:01:45,060
And after that we should import the S3 client.

26
00:01:45,060 --> 00:01:50,910
As you know that we have created a separate Node.js module that we can use these S3 client object for

27
00:01:50,910 --> 00:01:51,570
that purpose.

28
00:01:51,570 --> 00:01:58,530
I'm going to use this client package, but this time it is not showing for me for that purpose.

29
00:01:58,530 --> 00:02:01,440
Please write this import statement manually.

30
00:02:01,530 --> 00:02:06,360
And in this stage the important part is please don't forget that that JS file.

31
00:02:06,390 --> 00:02:10,860
Otherwise it can be c these separate Node.js module.

32
00:02:10,890 --> 00:02:17,010
So make sure that you have import these two statements and after that our code is ready to run with

33
00:02:17,010 --> 00:02:20,190
using the S3 client and sending the list bucket command.

34
00:02:20,400 --> 00:02:23,070
Save this file and open the terminal.

35
00:02:23,160 --> 00:02:29,400
Go to the correct location and run the node command in our local computer with pasting the our list

36
00:02:29,400 --> 00:02:32,160
pocket JavaScript file hit enter.

37
00:02:33,800 --> 00:02:36,770
So as you can see that it is getting a success response.

38
00:02:36,770 --> 00:02:43,310
And on my computer on my a the Willis Cloud environment I have one S3 bucket and that's why we will

39
00:02:43,310 --> 00:02:44,960
see the name and creation date.

40
00:02:44,960 --> 00:02:51,890
But if you don't have any bucket on your Willis account, you don't see any bucket, but at least we

41
00:02:51,890 --> 00:02:53,150
get the success response.

42
00:02:53,150 --> 00:02:57,530
That means we can list the buckets correctly and be expected.

43
00:02:57,530 --> 00:03:00,620
So in the next video we will create an Amazon S3 bucket.
