-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotationComandBucket
More file actions
49 lines (44 loc) · 1.82 KB
/
notationComandBucket
File metadata and controls
49 lines (44 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// *************************************
// * Listando todos os buckets *
// *************************************
// try {
// List<Bucket> buckets = s3Client.listBuckets().buckets();
// System.out.println("Lista de buckets:");
// for (Bucket bucket : buckets) {
// System.out.println("- " + bucket.name());
// }
// } catch (S3Exception e) {
// System.err.println("Erro ao listar buckets: " + e.getMessage());
// }
// *************************************
// * Listando objetos do bucket *
// *************************************
// try {
// ListObjectsRequest listObjects = ListObjectsRequest.builder()
// .bucket(bucketName)
// .build();
//
// List<S3Object> objects = s3Client.listObjects(listObjects).contents();
// System.out.println("Objetos no bucket " + bucketName + ":");
// for (S3Object object : objects) {
// System.out.println("- " + object.key());
// }
// } catch (S3Exception e) {
// System.err.println("Erro ao listar objetos no bucket: " + e.getMessage());
// }
// *************************************
// * Deletando um objeto do bucket *
// *************************************
// try {
// String objectKeyToDelete = "identificador-do-arquivo";
// DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder()
// .bucket(bucketName)
// .key(objectKeyToDelete)
// .build();
// s3Client.deleteObject(deleteObjectRequest);
//
// System.out.println("Objeto deletado com sucesso: " + objectKeyToDelete);
// } catch (S3Exception e) {
// System.err.println("Erro ao deletar objeto: " + e.getMessage());
// }
// }