feat: initial commit. some work have already been done tho.

This commit is contained in:
2025-05-24 16:08:55 +03:00
commit 05bc8381cd
4 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package ua.com.dxrkness;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
final var s3 = S3Client.builder()
.region(Region.EU_CENTRAL_1)
.build();
try (s3) {
s3.listBuckets().buckets().forEach(System.out::println);
}
}
}

View File

@ -0,0 +1,41 @@
package ua.com.dxrkness;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.S3Object;
import java.nio.file.Path;
import java.util.List;
public class S3Service {
private final S3Client client;
private final String bucketName;
public S3Service(S3Client client, String bucketName) {
this.client = client;
this.bucketName = bucketName;
}
public void createDirectory(Path path) {
throw new UnsupportedOperationException();
}
public Boolean delete(Path path) {
return client
.deleteObject(b -> b.bucket(bucketName).key(path.toString()).build())
.deleteMarker();
}
public List<S3Object> listing(Path path) {
return client
.listObjectsV2(b -> b.bucket(bucketName).build())
.contents();
}
public void uploadFile(Path path) {
throw new UnsupportedOperationException();
}
public String downloadFile(Path path) {
throw new UnsupportedOperationException();
}
}