Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

= Object Storage Client
:icons: font

image: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
----