PUT Object

Function Signatures
/**
* Uploads the specified file to galaxy fds with the specified object name
* under the specified bucket.
*
* @param bucketName The name of the bucket to put the object
* @param objectName The name of the object to put
* @param file       The file containing the data to be uploaded to fds
* @return A {@link PutObjectResult} containing the information returned by
*         galaxy fds for the newly created object
* @throws GalaxyFDSClientException
*/
public PutObjectResult putObject(String bucketName, String objectName,
  File file) throws GalaxyFDSClientException;

/**
* Uploads the data from the specified input stream to galaxy fds with the
* specified object name under the specified bucket.
*
* @param bucketName The name of the bucket to put the object
* @param objectName The name of the object to put
* @param input      The stream containing the data to be uploaded to fds
* @param metadata   Additional metadata instructing fds how to handle the
*                   uploaded data
* @return A {@link PutObjectResult} containing the information returned by
*         galaxy fds for the newly created object
* @throws GalaxyFDSClientException
*/
public PutObjectResult putObject(String bucketName, String objectName,
  InputStream input, FDSObjectMetadata metadata)
  throws GalaxyFDSClientException;
Example
File file = new File("/tmp/test");
PutObjectResult result = fdsClient.putObject(BUCKET_NAME, OBJECT_NAME, file);
System.out.println("signature: " + result.getSignature());
FDSObjectMetadata metadata = new FDSObjectMetadata();
metadata.addUserMetadata("x-xiaomi-meta-key", "x-xiaomi-meta-value");
InputStream in = new ByteArrayInputStream("object content".getBytes());
PutObjectResult result = fdsClient.putObject(BUCKET_NAME, OBJECT_NAME, in, metadata);
System.out.println("signature: " + result.getSignature());

POST Object

Function Signatures
/**
* Uploads the specified file to a galaxy fds bucket, an unique object name
* will be returned after successfully uploading.
*
* @param bucketName The name of the bucket to post the object
* @param file       The file containing the data to be uploaded to fds
* @return A {@link PutObjectResult} containing the information returned by
*         galaxy fds for the newly created object
* @throws GalaxyFDSClientException
*/
public PutObjectResult postObject(String bucketName, File file)
  throws GalaxyFDSClientException;

/**
* Uploads the data from the specified input stream to a galaxy fds bucket, an
* unique object name will be returned after successfully uploading.
*
* @param bucketName The name of the bucket to put the object
* @param input      The stream containing the data to be uploaded to fds
* @param metadata   Additional metadata instructing fds how to handle the
*                   uploaded data
* @return A {@link PutObjectResult} containing the information returned by
*         galaxy fds for the newly created object
* @throws GalaxyFDSClientException
*/
public PutObjectResult postObject(String bucketName, InputStream input,
  FDSObjectMetadata metadata) throws GalaxyFDSClientException;
Example
File file = new File("/tmp/test");
PutObjectResult result = fdsClient.postObject(BUCKET_NAME, file);
System.out.println("objectName: " + result.getObjectName() +
    ", signature: " + result.getSignature());
FDSObjectMetadata metadata = new FDSObjectMetadata();
metadata.addUserMetadata("x-xiaomi-meta-key", "x-xiaomi-meta-value");
InputStream in = new ByteArrayInputStream("object content".getBytes());
PutObjectResult result = fdsClient.postObject(BUCKET_NAME, in, metadata);
System.out.println("objectName: " + result.getObjectName() +
    ", signature: " + result.getSignature());

GET Object

Function Signatures
/**
* Gets the object stored in galaxy fds with the specified name under the
* specified bucket.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to get
* @return The object stored in galaxy fds under the specifed bucket
* @throws GalaxyFDSClientException
*/
public FDSObject getObject(String bucketName, String objectName)
  throws GalaxyFDSClientException;

/**
* Gets the object stored in galaxy fds with the specified name under the
* specified bucket.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to get
* @param pos        The position to start read
* @return The object stored in galaxy fds under the specifed bucket
* @throws GalaxyFDSClientException
*/
public FDSObject getObject(String bucketName, String objectName, long pos)
  throws GalaxyFDSClientException;
Example
FDSObject object = fdsClient.getObject(BUCKET_NAME, OBJECT_NAME);
FDSObjectInputStream in = object.getObjectContent();

HEAD Object

Function Signatures
/**
* Checks if the object with the specified name under the specified bucket
* exists.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to check
* @return The value true if the specified object exists, otherwise false
* @throws GalaxyFDSClientException
*/
public boolean doesObjectExist(String bucketName, String objectName)
  throws GalaxyFDSClientException;
Example
boolean exist = fdsClient.doesObjectExist(BUCKET_NAME, OBJECT_NAME);

PUT Object ACL

Function Signatures
/**
* Sets the AccessControlList(ACL) of the specified fds object.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to set acl
* @param acl        The ACL to set for the specified object
* @throws GalaxyFDSClientException
*/
public void setObjectAcl(String bucketName, String objectName,
  AccessControlList acl) throws GalaxyFDSClientException;
Example
AccessControlList acl = new AccessControlList();
Grant grant = new Grant("12346", Permission.READ, GrantType.USER);
acl.addGrant(grant);
fdsClient.setObjectAcl(BUCKET_NAME, OBJECT_NAME, acl);

GET Object ACL

Function Signatures
/**
* Gets the AccessControlList(ACL) of the specified fds object.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to get acl
* @return The {@link AccessControlList} of the specified object
* @throws GalaxyFDSClientException
*/
public AccessControlList getObjectAcl(String bucketName, String objectName)
  throws GalaxyFDSClientException;
Example
AccessControlList acl = fdsClient.getObjectAcl(BUCKET_NAME, OBJECT_NAME);
for (Grant grant : acl.getGrantList()) {
  System.out.println("grantee: " + grant.getGranteeId() + ", permission: "

      + grant.getPermission() + ", type: " + grant.getType());
}

GET Object metadata

Function Signatures
/**
* Gets the meta information of object with the specified name under the
* specified bucket.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to get the meta inforamtion
* @return The meta information of the object with the specified name under
*         the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectMetadata getObjectMetadata(String bucketName,
  String objectName) throws GalaxyFDSClientException;
Example
FDSObjectMetadata metadata = fdsClient.getObjectMetadata(BUCKET_NAME, OBJECT_NAME); 
for (Map.Entry<String, String> entry : metadata.getRawMetadata().entrySet()) {
  System.out.println("key: " + entry.getKey() + ", value: " + entry.getValue());
}

DELETE Object

Function Signatures
/**
* Deletes the object with the specified name under the specified bucket.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to delete
* @throws GalaxyFDSClientException
*/
public void deleteObject(String bucketName, String objectName)
  throws GalaxyFDSClientException;
Example
fdsClient.deleteObject(BUCKET_NAME, OBJECT_NAME)

Delete multiple Objects

Function Signatures
/**
* Deletes objects with specified prefix under specified bucket.
*
* @param bucketName The name of the bucket where the objects store
* @param prefix     An optional parameter restricting the response to keys
*                    beginning with the specified prefix.
* @throws GalaxyFDSClientException
* @return list of failed deletion:
* [
*   {
*     "object_name": "$OBJECT_NAME",
*     "error_code": $ERROR_CODE,
*     "error_description": "$ERROR_MESSAGE"
*   }
*   ,...
* ]
*/
public List<Map<String, Object>> deleteObjects(String bucketName, String prefix)
  throws GalaxyFDSClientException;

/**
* Deletes the objects with the specified name under the specified bucket,
* length of objectNameList limit to 1k
* @param bucketName     The name of the bucket where the objects store
* @param objectNameList The list of names of the object to delete
* @throws GalaxyFDSClientException
* @return list of failed deletion:
* [
*   {
*     "object_name": "$OBJECT_NAME",
*     "error_code": $ERROR_CODE,
*     "error_description": "$ERROR_MESSAGE"
*   }
*   ,...
* ]
*/
public List<Map<String, Object>> deleteObjects(String bucketName, List<String> objectNameList)
  throws GalaxyFDSClientException;
Example
fdsClient.deleteObjects(BUCKET_NAME, "object-prefix");
List<String> objectNames = new ArrayList<String>();
objectNames.add("object-name1");
objectNames.add("object-name2");
fdsClient.deleteObjects(BUCKET_NAME, objectNames);

Restore Object

Function Signatures
/**
* Restore the object from trash.
*
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to restore
* @throws GalaxyFDSClientException
*/
public void restoreObject(String bucketName, String objectName)
  throws GalaxyFDSClientException;
Example
fdsClient.restoreObject(BUCKET_NAME, OBJECT_NAME);

Rename Object

Function Signatures
/**
* Rename the object with the specified name under the specified bucket.
*
* @param bucketName    The name of the bucket where the object stores
* @param srcObjectName The name of the source object
* @param dstObjectName The name of the destination object
* @throws GalaxyFDSClientException
*/
public void renameObject(String bucketName, String srcObjectName, String dstObjectName)
  throws GalaxyFDSClientException;
Example
fdsClient.renameObject(BUCKET_NAME, OBJECT_NAME, "dst-object-name");

Prefetch Object

Function Signatures
/**
* Prefetch the specified object to cdn. The object must have public access
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to prefetch
* @throws GalaxyFDSClientException
*/
public void prefetchObject(String bucketName, String objectName)
  throws GalaxyFDSClientException;
Example
fdsClient.prefetchObject(BUCKET_NAME, OBJECT_NAME);

Refresh Object

Function Signatures
/**
* Refresh the object cached in cdn. The object must have public access
* @param bucketName The name of the bucket where the object stores
* @param objectName The name of the object to refresh
* @throws GalaxyFDSClientException
*/
public void refreshObject(String bucketName, String objectName)
  throws GalaxyFDSClientException;
Example
fdsClient.refreshObject(BUCKET_NAME, OBJECT_NAME);

Init multipart upload

Function Signatures
/**
* Init a multipart upload session
* @param bucketName
* @param objectName
* @return A InitMultipartUploadResult which contains uploadId.
* @throws GalaxyFDSClientException
*/
public InitMultipartUploadResult initMultipartUpload(String bucketName,
  String objectName) throws GalaxyFDSClientException;
Example
InitMultipartUploadResult initMultipartUploadResult =
    fdsClient.initMultipartUpload(BUCKET_NAME, OBJECT_NAME);
System.out.println(initMultipartUploadResult.getUploadId());
Other

Explanation of Fragment Upload Process

Upload part

Function Signatures
/**
* Upload a part
* @param bucketName
* @param objectName
* @param uploadId
* @param partNumber The part number of this part.
* @param in
* @return A UploadPartResult which contains the part's ETag.
* @throws GalaxyFDSClientException
*/
public UploadPartResult uploadPart(String bucketName, String objectName,
  String uploadId, int partNumber, InputStream in)
  throws GalaxyFDSClientException;
Example
InputStream part1 = new ByteArrayInputStream("part 1".getBytes());
UploadPartResult uploadPartResult1 = fdsClient.uploadPart(BUCKET_NAME,
    OBJECT_NAME, uploadId, 1, part1);
InputStream part2 = new ByteArrayInputStream("part 2".getBytes());
UploadPartResult uploadPartResult2 = fdsClient.uploadPart(BUCKET_NAME,
    OBJECT_NAME, uploadId, 2, part2);
Other

Explanation of Fragment Upload Process

Complete multipart upload

Function Signatures
/**
* Complete the multipart upload.
* @param bucketName
* @param objectName
* @param uploadId
* @param metadata
* @param uploadPartResultList The UploadPartResult list contains UploadPartResult
*                             returned by uploadPart.
* @return A PutObjectResult which is the same as the one returned by putObject.
*/
public PutObjectResult completeMultipartUpload(String bucketName,
  String objectName, String uploadId, FDSObjectMetadata metadata,
  UploadPartResultList uploadPartResultList) throws GalaxyFDSClientException;
Example
PutObjectResult result = fdsClient.completeMultipartUpload(BUCKET_NAME,
    OBJECT_NAME, uploadId, metadata, uploadPartResultList);
System.out.println("signature: " + result.getSignature());
Other

Explanation of Fragment Upload Process

Abort multipart upload

Function Signatures
/**
* Abort the multipart upload session.
* @param bucketName
* @param objectName
* @param uploadId
* @throws GalaxyFDSClientException
*/
public void abortMultipartUpload(String bucketName, String objectName,
  String uploadId) throws GalaxyFDSClientException;
Example
fdsClient.abortMultipartUpload(BUCKET_NAME, OBJECT_NAME, uploadId);
Other

Explanation of Fragment Upload Process

Generate presigned URL

Function Signatures
/**
* Returns a pre-signed URI for accessing Galaxy FDS resource.
*
* @param bucketName The name of the bucket containing the desired object
* @param objectName The name of the desired object
* @param expiration The time at which the returned pre-signed URL will expire
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to download the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedUri(String bucketName, String objectName,
  Date expiration) throws GalaxyFDSClientException;

/**
* Returns a pre-signed CDN URI for accessing Galaxy FDS resource.
*
* @param bucketName The name of the bucket containing the desired object
* @param objectName The name of the desired object
* @param expiration The time at which the returned pre-signed URL will expire
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to download the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedCdnUri(String bucketName, String objectName,
  Date expiration) throws GalaxyFDSClientException;

/**
* Returns a pre-signed URI for accessing Galaxy FDS resource.
*
* @param bucketName The name of the bucket containing the desired object
* @param objectName The name of the desired object
* @param expiration The time at which the returned pre-signed URL will expire
* @param httpMethod The HTTP method verb to use for this URL
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to access the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedUri(String bucketName, String objectName,
  Date expiration, HttpMethod httpMethod) throws GalaxyFDSClientException;

/**
* Returns a pre-signed CDN URI for accessing Galaxy FDS resource.
*
* @param bucketName The name of the bucket containing the desired object
* @param objectName The name of the desired object
* @param expiration The time at which the returned pre-signed URL will expire
* @param httpMethod The HTTP method verb to use for this URL
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to access the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedCdnUri(String bucketName, String objectName,
  Date expiration, HttpMethod httpMethod) throws GalaxyFDSClientException;

/**
* Returns a pre-signed URI for accessing Galaxy FDS resource.
*
* @param bucketName  The name of the bucket containing the desired object
* @param objectName  The name of the desired object
* @param subResource The subresource of this request
* @param expiration  The time at which the returned pre-signed URL will expire
* @param httpMethod  The HTTP method verb to use for this URL
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to access the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedUri(String bucketName, String objectName,
  SubResource subResource, Date expiration, HttpMethod httpMethod)
  throws GalaxyFDSClientException;

/**
* Returns a pre-signed URI for accessing Galaxy FDS resource.
*
* @param bucketName   The name of the bucket containing the desired object
* @param objectName   The name of the desired object
* @param subResources The subresource list of this request
* @param expiration   The time at which the returned pre-signed URL will expire
* @param httpMethod   The HTTP method verb to use for this URL
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to access the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedUri(String bucketName, String objectName,
  List<String> subResources, Date expiration, HttpMethod httpMethod)
  throws GalaxyFDSClientException;

/**
* Returns a pre-signed CDN URI for accessing Galaxy FDS resource.
*
* @param bucketName  The name of the bucket containing the desired object
* @param objectName  The name of the desired object
* @param subResource The subresource of this request
* @param expiration  The time at which the returned pre-signed URL will expire
* @param httpMethod  The HTTP method verb to use for this URL
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to access the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedCdnUri(String bucketName, String objectName,
  SubResource subResource, Date expiration, HttpMethod httpMethod)
  throws GalaxyFDSClientException;

/**
* Returns a pre-signed CDN URI for accessing Galaxy FDS resource.
*
* @param bucketName   The name of the bucket containing the desired object
* @param objectName   The name of the desired object
* @param subResources The subresource list of this request
* @param expiration   The time at which the returned pre-signed URL will expire
* @param httpMethod   The HTTP method verb to use for this URL
* @return A pre-signed URL which expires at the specified time, and can be
*         used to allow anyone to access the specified object from galaxy
*         fds, without exposing the owner's Galaxy secret access key.
* @throws GalaxyFDSClientException
*/
public URI generatePresignedCdnUri(String bucketName, String objectName,
  List<String> subResources, Date expiration, HttpMethod httpMethod)
  throws GalaxyFDSClientException;
Example
URI uri = fdsClient.generatePresignedUri(BUCKET_NAME, OBJECT_NAME,
    new Date(2016, 2, 3));
URI uri = fdsClient.generatePresignedUri(BUCKET_NAME, OBJECT_NAME,
    new Date(2016, 2, 3), HttpMethod.PUT);
URI uri = fdsClient.generatePresignedUri(BUCKET_NAME, OBJECT_NAME, SubResource.UPLOADS,
    new Date(2016, 2, 3), HttpMethod.PUT);
List<String> subResources = new ArrayList<String>();
subResources.add(SubResource.UPLOAD_ID.name());
subResources.add(SubResource.PART_NUMBER.name());
URI uri = fdsClient.generatePresignedUri(BUCKET_NAME, OBJECT_NAME, subResources,
    new Date(2016, 2, 3), HttpMethod.PUT);
URI uri = fdsClient.generatePresignedCdnUri(BUCKET_NAME, OBJECT_NAME,
    new Date(2016, 2, 3));
URI uri = fdsClient.generatePresignedCdnUri(BUCKET_NAME, OBJECT_NAME,
    new Date(2016, 2, 3), HttpMethod.PUT);
URI uri = fdsClient.generatePresignedCdnUri(BUCKET_NAME, OBJECT_NAME, SubResource.UPLOADS,
    new Date(2016, 2, 3), HttpMethod.PUT);
List<String> subResources = new ArrayList<String>();
subResources.add(SubResource.UPLOAD_ID.name());
subResources.add(SubResource.PART_NUMBER.name());
URI uri = fdsClient.generatePresignedCdnUri(BUCKET_NAME, OBJECT_NAME, subResources,
    new Date(2016, 2, 3), HttpMethod.PUT);

results matching ""

    No results matching ""