Ambry-client for Java

The Ambry-client used for accessing Ambry RESTful API

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.thewaychung
ArtifactId

ArtifactId

ambry-client
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Ambry-client for Java
The Ambry-client used for accessing Ambry RESTful API
Project URL

Project URL

https://github.com/thewaychung/ambry-client
Source Code Management

Source Code Management

https://github.com/thewaychung/ambry-client.git

Download ambry-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.thewaychung/ambry-client/ -->
<dependency>
    <groupId>com.github.thewaychung</groupId>
    <artifactId>ambry-client</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.thewaychung/ambry-client/
implementation 'com.github.thewaychung:ambry-client:1.0'
// https://jarcasting.com/artifacts/com.github.thewaychung/ambry-client/
implementation ("com.github.thewaychung:ambry-client:1.0")
'com.github.thewaychung:ambry-client:jar:1.0'
<dependency org="com.github.thewaychung" name="ambry-client" rev="1.0">
  <artifact name="ambry-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.thewaychung', module='ambry-client', version='1.0')
)
libraryDependencies += "com.github.thewaychung" % "ambry-client" % "1.0"
[com.github.thewaychung/ambry-client "1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.5.2
log4j : log4j jar 1.2.17
org.slf4j : slf4j-api jar 1.7.21

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Ambry-client

Ambry-client is a Java SDK to call the Ambry, a distributed object store, RESTful API use Java code. If you don't have knowledge about Ambry, e.g.: how to install Ambry, what is ambryId. Please firstly read Ambry Wiki and then come back to use this library.

How do I use it?

###Maven

Use it as a maven dependency:

<dependency>
    <groupId>com.github.thewaychung</groupId>
    <artifactId>ambry-client</artifactId>
    <version>1.0</version>
</dependency>

###Usage

AmbryClient ambryClient = AmbryClient("localhost", 1174);

// 1.healthCheck
AmbryBaseResponse response = ambryClient.healthCheck();
String status = response.getStatus();
// return: GOOD

// 2.GET-blobInfo
AmbryBlobInfoResponse response = ambryClient.getFileProperty(ambryId)
// return: blobSize, serviceId, creationTime, private, contentType, ownerId, umDesc

// 3.GET-blob
AmbryGetFileResponse response = ambryClient.getFile(ambryId);
byte[] data = ambryClient.readFromStream(response.getContent());
// return: blobSize, contentType, content(InputStream)
// OR use:
AmbryGetFileResponse response = ambryClient.getFile(ambryId, localFile);
// this method will download blob and write into the local file passed in

// 4.POST
// upload file with filepath and file type string
AmbryPostFileResponse postResponse = ambryClient.postFile(filePath, "text/plain");
// upload file with file object and type string
AmbryPostFileResponse postResponse = ambryClient.postFile(file, "image/jpg");
// upload file with byte array and type string
byte[] content = getFileBytes(file);
AmbryPostFileResponse postResponse = ambryClient.postFile(content, fileTypeString);
// return: ambryId

// 5.DELETE
AmbryBaseResponse delResponse = ambryClient.deleteFile(ambryId);
// return: code(202), status, message

#License Ambry-client is released under the MIT LICENSE

Versions

Version
1.0