Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emadalblueshi/object-storage-client
Object storage client based on Vert.x
https://github.com/emadalblueshi/object-storage-client
amazon-s3 java object-storage reactive reactive-programming s3 vertx
Last synced: 29 days ago
JSON representation
Object storage client based on Vert.x
- Host: GitHub
- URL: https://github.com/emadalblueshi/object-storage-client
- Owner: EmadAlblueshi
- License: apache-2.0
- Created: 2024-06-03T16:54:34.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-06-15T19:20:14.000Z (5 months ago)
- Last Synced: 2024-09-26T07:40:10.464Z (about 1 month ago)
- Topics: amazon-s3, java, object-storage, reactive, reactive-programming, s3, vertx
- Language: Java
- Homepage:
- Size: 104 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Object Storage Client
:icons: fontimage:https://github.com/EmadAlblueshi/object-storage-client/actions/workflows/ci.yml/badge.svg?branch=master["Build Status", link="https://github.com/EmadAlblueshi/object-storage-client/actions?query=workflow%3ACI"]
A convenient S3 client based on Vert.x that is compatible with
https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html[Amazon S3 REST API protocol]WARNING: The module in active development, this means the API can change between versions.
== Example
[source,java]
----
// Create auth options
var authOptions = new S3AuthOptions()
.setSignatureVersion(SignatureVersion.V4)
.setAccessKey("access-key")
.setSecretKey("secret-key");// Create client options
var clientOptions = new S3ClientOptions()
.setAuthOptions(authOptions)
.setRegion("kw-west-1")
.setHost("s3.example.com")
.setPort(443)
.setSsl(true);// Create the client
var client = S3Client.create(vertx, clientOptions);// Create new general purpose bucket
client.putBucket(new BucketOptions(), "/my-bucket").onComplete(r -> {
if (r.succeeded()) {
System.out.println("Bucket created");
} else {
System.out.println("Bucket failed");
}
});// Create object request options
var objectOptions = new ObjectOptions()
.contentType("text/plain")
.storageClass(StorageClass.STANDARD)
.acl(Acl.PUBLIC_READ);// Read an existing text file
Buffer fileBuffer = vertx.fileSystem().readFileBlocking("example.txt");// Create new object
client.put(objectOptions, "/my-bucket/my-object.txt", fileBuffer).onComplete(r -> {
if (r.succeeded()) {
System.out.println("Object created");
} else {
System.out.println("Object failed");
}
});
----== Building
To launch the tests:
----
mvn clean test
----To package:
----
mvn clean package -DskipTests
----To package with site
----
mvn clean package -DskipTests site
----