From the course: AWS for Developers: S3

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Bucket manipulation

Bucket manipulation - Amazon Web Services (AWS) Tutorial

From the course: AWS for Developers: S3

Start my 1-month free trial

Bucket manipulation

- [Instructor] So just like we did with Python, now we're going to take a look at some of those bucket-level operations that we can use, that are most common to the s decay. Once again, return to our application class, and we're going to create a couple methods. So, the first one, will return a list of string objects, called listFiles. And we'll pass it a bucket. Create a new ArrayList. And then we'll do our try block. This time we're going to use the ListObjectsRequest. Once again, we'll use the builder and we'll pass it the bucket. Now, we're going to do the ListObjectsResponse. Call on s3 the listObjects command, pass it the request. And now on our response, we're going to look at the contents, and we'll call forEach on that. And I'm going to do a little lambda here on content.key. So that should build us a list of keys. We will copy and paste this catch block, and we'll return our keys when we are done. So…

Contents