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

40
.gitignore vendored Normal file
View File

@ -0,0 +1,40 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
.idea

25
pom.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ua.com.dxrkness</groupId>
<artifactId>aws-example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>23</maven.compiler.source>
<maven.compiler.target>23</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<version>2.25.27</version>
</dependency>
</dependencies>
</project>

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();
}
}