com.baidubce.services.bos
Class BosClient

java.lang.Object
  extended by com.baidubce.AbstractBceClient
      extended by com.baidubce.services.bos.BosClient

public class BosClient
extends AbstractBceClient

Provides the client for accessing the Baidu Object Service.


Field Summary
static String STORAGE_CLASS_COLD
          Cold access BOS storage class
static String STORAGE_CLASS_STANDARD
          Standard BOS storage class
static String STORAGE_CLASS_STANDARD_IA
          Infrequent access BOS storage class
 
Fields inherited from class com.baidubce.AbstractBceClient
config, DEFAULT_CONTENT_TYPE, DEFAULT_ENCODING, DEFAULT_SERVICE_DOMAIN, URL_PREFIX
 
Constructor Summary
BosClient()
          Constructs a new client to invoke service methods on Bos.
BosClient(BosClientConfiguration clientConfiguration)
          Constructs a new Bos client using the client configuration to access Bos.
 
Method Summary
 void abortMultipartUpload(AbortMultipartUploadRequest request)
          Aborts a multipart upload.
 void abortMultipartUpload(String bucketName, String key, String uploadId)
          Aborts a multipart upload.
 AppendObjectResponse appendObject(AppendObjectRequest request)
          Uploads a new object to the specified Bos bucket.
 AppendObjectResponse appendObject(String bucketName, String key, byte[] value)
          Uploads the specified bytes to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, byte[] value, ObjectMetadata metadata)
          Uploads the appendable bytes and object metadata to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, File file)
          Uploads the specified appendable file to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, File file, ObjectMetadata metadata)
          Uploads the specified appendable file to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, InputStream input)
          Uploads the appendable input stream to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, InputStream input, ObjectMetadata metadata)
          Uploads the appendable input stream and object metadata to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, String value)
          Uploads the specified string to Bos under the specified bucket and key name.
 AppendObjectResponse appendObject(String bucketName, String key, String value, ObjectMetadata metadata)
          Uploads the specified string and object metadata to Bos under the specified bucket and key name.
 CompleteMultipartUploadResponse completeMultipartUpload(CompleteMultipartUploadRequest request)
          Completes a multipart upload by assembling previously uploaded parts.
 CompleteMultipartUploadResponse completeMultipartUpload(String bucketName, String key, String uploadId, List<PartETag> partETags)
          Completes a multipart upload by assembling previously uploaded parts.
 CompleteMultipartUploadResponse completeMultipartUpload(String bucketName, String key, String uploadId, List<PartETag> partETags, ObjectMetadata metadata)
          Completes a multipart upload by assembling previously uploaded parts.
 CopyObjectResponse copyObject(CopyObjectRequest request)
          Copies a source object to a new destination in Bos.
 CopyObjectResponse copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey)
          Copies a source object to a new destination in Bos.
 CreateBucketResponse createBucket(CreateBucketRequest request)
          Creates a new Bos bucket with the specified name.
 CreateBucketResponse createBucket(String bucketName)
          Creates a new Bos bucket with the specified name.
 void deleteBucket(DeleteBucketRequest request)
          Deletes the specified bucket.
 void deleteBucket(String bucketName)
          Deletes the specified bucket.
 void deleteBucketCors(DeleteBucketCorsRequest request)
          Delete the CORS for the specified Bos bucket.
 void deleteBucketLifecycle(DeleteBucketLifecycleRequest request)
          Delete the Lifecycle for the specified Bos bucket.
 void deleteBucketLogging(DeleteBucketLoggingRequest request)
          Delete the Logging for the specified Bos bucket.
 DeleteMultipleObjectsResponse deleteMultipleObjects(DeleteMultipleObjectsRequest request)
          Deletes the multiple specified objects in the specified bucket.
 void deleteObject(DeleteObjectRequest request)
          Deletes the specified object in the specified bucket.
 void deleteObject(String bucketName, String key)
          Deletes the specified object in the specified bucket.
 void deleteObjectAcl(DeleteObjectAclRequest request)
          Delete Object Acl for specified object in the specified bucket.
 boolean doesBucketExist(DoesBucketExistRequest request)
          Checks if the specified bucket exists.
 boolean doesBucketExist(String bucketName)
          Checks if the specified bucket exists.
 FetchObjectResponse fetchObject(FetchObjectRequest request)
          Fetches a source object to a new destination in Bos.
 FetchObjectResponse fetchObject(String bucketName, String key, String sourceUrl)
          Fetches a source object to a new destination in Bos.
 FetchObjectResponse fetchObject(String bucketName, String key, String sourceUrl, String mode)
          Fetches a source object to a new destination in Bos.
 URL generatePresignedUrl(GeneratePresignedUrlRequest request)
          Returns a pre-signed URL for accessing a Bos resource.
 URL generatePresignedUrl(String bucketName, String key, int expirationInSeconds)
          Returns a pre-signed URL for accessing a Bos resource.
 URL generatePresignedUrl(String bucketName, String key, int expirationInSeconds, HttpMethodName method)
          Returns a pre-signed URL for accessing a Bos resource.
 User getBosAccountOwner()
          Gets the current owner of the Bos account that the authenticated sender of the request is using.
 User getBosAccountOwner(GetBosAccountOwnerRequest request)
          Gets the current owner of the Bos account that the authenticated sender of the request is using.
 GetBucketAclResponse getBucketAcl(GetBucketAclRequest request)
          Gets the ACL for the specified Bos bucket.
 GetBucketAclResponse getBucketAcl(String bucketName)
          Gets the ACL for the specified Bos bucket.
 GetBucketCorsResponse getBucketCros(GetBucketCorsRequest request)
          Gets the CORS for the specified Bos bucket.
 GetBucketLifecycleResponse getBucketLifecycle(GetBucketLifecycleRequest request)
          Gets Lifecycle for the specified Bos bucket.
 GetBucketLocationResponse getBucketLocation(GetBucketLocationRequest request)
          Gets the Location for the specified Bos bucket.
 GetBucketLocationResponse getBucketLocation(String bucketName)
          Gets the Location for the specified Bos bucket.
 GetBucketLoggingResponse getBucketLogging(GetBucketLoggingRequest request)
          Gets the Logging for the specified Bos bucket.
 BosObject getObject(GetObjectRequest request)
          Gets the object stored in Bos under the specified bucket and key.
 ObjectMetadata getObject(GetObjectRequest request, File destinationFile)
          Gets the object metadata for the object stored in Bos under the specified bucket and key, and saves the object contents to the specified file.
 BosObject getObject(String bucketName, String key)
          Gets the object stored in Bos under the specified bucket and key.
 ObjectMetadata getObject(String bucketName, String key, File destinationFile)
          Gets the object metadata for the object stored in Bos under the specified bucket and key, and saves the object contents to the specified file.
 GetObjectAclResponse getObjectAcl(GetObjectAclRequest request)
          Get Object Acl for specified object in the specified bucket.
 byte[] getObjectContent(GetObjectRequest request)
          Gets the object content stored in Bos under the specified bucket and key.
 byte[] getObjectContent(String bucketName, String key)
          Gets the object content stored in Bos under the specified bucket and key.
 ObjectMetadata getObjectMetadata(GetObjectMetadataRequest request)
          Gets the metadata for the specified Bos object without actually fetching the object itself.
 ObjectMetadata getObjectMetadata(String bucketName, String key)
          Gets the metadata for the specified Bos object without actually fetching the object itself.
 InitiateMultipartUploadResponse initiateMultipartUpload(InitiateMultipartUploadRequest request)
          Initiates a multipart upload and returns an InitiateMultipartUploadResponse which contains an upload ID.
 InitiateMultipartUploadResponse initiateMultipartUpload(String bucketName, String key)
          Initiates a multipart upload and returns an InitiateMultipartUploadResponse which contains an upload ID.
 ListBucketsResponse listBuckets()
          Returns a list of all Bos buckets that the authenticated sender of the request owns.
 ListBucketsResponse listBuckets(ListBucketsRequest request)
          Returns a list of all Bos buckets that the authenticated sender of the request owns.
 ListMultipartUploadsResponse listMultipartUploads(ListMultipartUploadsRequest request)
          Lists in-progress multipart uploads.
 ListMultipartUploadsResponse listMultipartUploads(String bucketName)
          Lists in-progress multipart uploads.
 ListObjectsResponse listNextBatchOfObjects(ListObjectsResponse previousResponse)
          Provides an easy way to continue a truncated object listing and retrieve the next page of results.
 ListObjectsResponse listObjects(ListObjectsRequest request)
          Returns ListObjectsResponse containing a list of summary information about the objects in the specified buckets.
 ListObjectsResponse listObjects(String bucketName)
          Returns ListObjectsResponse containing a list of summary information about the objects in the specified buckets.
 ListObjectsResponse listObjects(String bucketName, String prefix)
          Returns ListObjectsResponse containing a list of summary information about the objects in the specified buckets.
 ListPartsResponse listParts(ListPartsRequest request)
          Lists the parts that have been uploaded for a specific multipart upload.
 ListPartsResponse listParts(String bucketName, String key, String uploadId)
          Lists the parts that have been uploaded for a specific multipart upload.
 PutObjectResponse putObject(PutObjectRequest request)
          Uploads a new object to the specified Bos bucket.
 PutObjectResponse putObject(String bucketName, String key, byte[] value)
          Uploads the specified bytes to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, byte[] value, ObjectMetadata metadata)
          Uploads the specified bytes and object metadata to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, File file)
          Uploads the specified file to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, File file, ObjectMetadata metadata)
          Uploads the specified file and object metadata to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, InputStream input)
          Uploads the specified input stream to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, InputStream input, ObjectMetadata metadata)
          Uploads the specified input stream and object metadata to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, String value)
          Uploads the specified string to Bos under the specified bucket and key name.
 PutObjectResponse putObject(String bucketName, String key, String value, ObjectMetadata metadata)
          Uploads the specified string and object metadata to Bos under the specified bucket and key name.
 void setBucketAcl(SetBucketAclRequest request)
          Sets the Acl for the specified Bos bucket.
 void setBucketAcl(String bucketName, CannedAccessControlList acl)
          Sets the CannedAccessControlList for the specified Bos bucket using one of the pre-configured CannedAccessControlLists.
 void setBucketAcl(String bucketName, String jsonAcl)
          Sets the json style of bucket acl for the specified Bos bucket using one of the pre-configured CannedAccessControlLists.
 void setBucketBucketLifecycle(SetBucketLifecycleRequest request)
          Sets the Lifecycle for the specified Bos bucket.
 void setBucketCors(SetBucketCorsRequest request)
          Sets the CORS for the specified Bos bucket.
 void setBucketLogging(SetBucketLoggingRequest request)
          Sets the Logging for the specified Bos bucket.
 void setObjectAcl(SetObjectAclRequest request)
          Set Object Acl for specified object in the specified bucket.
 void setObjectAcl(String bucketName, String objectKey, CannedAccessControlList acl)
          Set Object Acl for specified object in the specified bucket.
 void setObjectAcl(String bucketName, String objectKey, String jsonObjectAcl)
          Set Object Acl for specified object in the specified bucket.
 UploadPartResponse uploadPart(UploadPartRequest request)
          Uploads a part in a multipart upload.
 UploadPartCopyResponse uploadPartCopy(UploadPartCopyRequest request)
          Uploads a copy part in a multipart upload.
 
Methods inherited from class com.baidubce.AbstractBceClient
getClient, getEndpoint, getServiceId, invokeHttpClient, isRegionSupported, setClient, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORAGE_CLASS_STANDARD

public static final String STORAGE_CLASS_STANDARD
Standard BOS storage class

See Also:
Constant Field Values

STORAGE_CLASS_STANDARD_IA

public static final String STORAGE_CLASS_STANDARD_IA
Infrequent access BOS storage class

See Also:
Constant Field Values

STORAGE_CLASS_COLD

public static final String STORAGE_CLASS_COLD
Cold access BOS storage class

See Also:
Constant Field Values
Constructor Detail

BosClient

public BosClient()
Constructs a new client to invoke service methods on Bos.


BosClient

public BosClient(BosClientConfiguration clientConfiguration)
Constructs a new Bos client using the client configuration to access Bos.

Parameters:
clientConfiguration - The bos client configuration options controlling how this client connects to Bos (e.g. proxy settings, retry counts, etc).
Method Detail

getBosAccountOwner

public User getBosAccountOwner()
Gets the current owner of the Bos account that the authenticated sender of the request is using.

The caller must authenticate with a valid BCE Access Key ID that is registered with Bos.

Returns:
The account of the authenticated sender

getBosAccountOwner

public User getBosAccountOwner(GetBosAccountOwnerRequest request)
Gets the current owner of the Bos account that the authenticated sender of the request is using.

The caller must authenticate with a valid BCE Access Key ID that is registered with Bos.

Parameters:
request - This request containing the credentials for getting the account of the authenticated sender.
Returns:
The account of the authenticated sender

listBuckets

public ListBucketsResponse listBuckets()
Returns a list of all Bos buckets that the authenticated sender of the request owns.

Users must authenticate with a valid BCE Access Key ID that is registered with Bos. Anonymous requests cannot list buckets, and users cannot list buckets that they did not create.

Returns:
All of the Bos buckets owned by the authenticated sender of the request.

listBuckets

public ListBucketsResponse listBuckets(ListBucketsRequest request)
Returns a list of all Bos buckets that the authenticated sender of the request owns.

Users must authenticate with a valid BCE Access Key ID that is registered with Bos. Anonymous requests cannot list buckets, and users cannot list buckets that they did not create.

Parameters:
request - The request containing all of the options related to the listing of buckets.
Returns:
All of the Bos buckets owned by the authenticated sender of the request.

createBucket

public CreateBucketResponse createBucket(String bucketName)
Creates a new Bos bucket with the specified name.

Parameters:
bucketName - The name of the bucket to create. All buckets in Bos share a single namespace; ensure the bucket is given a unique name.
Returns:
The newly created bucket.

createBucket

public CreateBucketResponse createBucket(CreateBucketRequest request)
Creates a new Bos bucket with the specified name.

Parameters:
request - The request object containing all options for creating a Bos bucket.
Returns:
The newly created bucket.

doesBucketExist

public boolean doesBucketExist(String bucketName)
Checks if the specified bucket exists. Bos buckets are named in a global namespace; use this method to determine if a specified bucket name already exists, and therefore can't be used to create a new bucket.

If invalid security credentials are used to execute this method, the client is not able to distinguish between bucket permission errors and invalid credential errors, and this method could return an incorrect result.

Parameters:
bucketName - The name of the bucket to check.
Returns:
The value true if the specified bucket exists in Bos; the value false if there is no bucket in Bos with that name.

doesBucketExist

public boolean doesBucketExist(DoesBucketExistRequest request)
Checks if the specified bucket exists. Bos buckets are named in a global namespace; use this method to determine if a specified bucket name already exists, and therefore can't be used to create a new bucket.

If invalid security credentials are used to execute this method, the client is not able to distinguish between bucket permission errors and invalid credential errors, and this method could return an incorrect result.

Parameters:
request - The request object containing all options for checking a Bos bucket.
Returns:
The value true if the specified bucket exists in Bos; the value false if there is no bucket in Bos with that name.

getBucketAcl

public GetBucketAclResponse getBucketAcl(String bucketName)
Gets the ACL for the specified Bos bucket.

Each bucket and object in Bos has an ACL that defines its access control policy. When a request is made, Bos authenticates the request using its standard authentication procedure and then checks the ACL to verify the sender was granted access to the bucket or object. If the sender is approved, the request proceeds. Otherwise, Bos returns an error.

Parameters:
bucketName - The name of the bucket whose ACL is being retrieved.
Returns:
The GetBuckeetAclResponse for the specified Bos bucket.

getBucketAcl

public GetBucketAclResponse getBucketAcl(GetBucketAclRequest request)
Gets the ACL for the specified Bos bucket.

Each bucket and object in Bos has an ACL that defines its access control policy. When a request is made, Bos authenticates the request using its standard authentication procedure and then checks the ACL to verify the sender was granted access to the bucket or object. If the sender is approved, the request proceeds. Otherwise, Bos returns an error.

Parameters:
request - The request containing the name of the bucket whose ACL is being retrieved.
Returns:
The GetBuckeetAclResponse for the specified Bos bucket.

getBucketLocation

public GetBucketLocationResponse getBucketLocation(String bucketName)
Gets the Location for the specified Bos bucket.

Each bucket and object in Bos has an Location that defines its location

Parameters:
bucketName - The name of the bucket whose Location is being retrieved.
Returns:
The GetBuckeetLocationResponse for the specified Bos bucket.

getBucketLocation

public GetBucketLocationResponse getBucketLocation(GetBucketLocationRequest request)
Gets the Location for the specified Bos bucket.

Each bucket and object in Bos has an Location that defines its location

Parameters:
request - The request containing the name of the bucket whose Location is being retrieved.
Returns:
The GetBuckeetLocationResponse for the specified Bos bucket.

setBucketAcl

public void setBucketAcl(String bucketName,
                         String jsonAcl)
Sets the json style of bucket acl for the specified Bos bucket using one of the pre-configured CannedAccessControlLists.

A json style of bucket acl provides a quick way to configure an object or bucket with commonly used access control policies.

Parameters:
bucketName - The name of the bucket whose ACL is being set.
jsonAcl - The pre-configured CannedAccessControlLists to set for the specified bucket.

setBucketAcl

public void setBucketAcl(String bucketName,
                         CannedAccessControlList acl)
Sets the CannedAccessControlList for the specified Bos bucket using one of the pre-configured CannedAccessControlLists.

A CannedAccessControlList provides a quick way to configure an object or bucket with commonly used access control policies.

Parameters:
bucketName - The name of the bucket whose ACL is being set.
acl - The pre-configured CannedAccessControlLists to set for the specified bucket.

setBucketAcl

public void setBucketAcl(SetBucketAclRequest request)
Sets the Acl for the specified Bos bucket.

Parameters:
request - The request object containing the bucket to modify and the ACL to set.

setBucketLogging

public void setBucketLogging(SetBucketLoggingRequest request)
Sets the Logging for the specified Bos bucket.

Parameters:
request - The request object containing the Logging to set into specified bucket.

getBucketLogging

public GetBucketLoggingResponse getBucketLogging(GetBucketLoggingRequest request)
Gets the Logging for the specified Bos bucket.

Parameters:
request - The request object containing the specified bucket to get bucket logging.

deleteBucketLogging

public void deleteBucketLogging(DeleteBucketLoggingRequest request)
Delete the Logging for the specified Bos bucket.

Parameters:
request - The request object containing the specified bucket to delete bucket logging.

setBucketCors

public void setBucketCors(SetBucketCorsRequest request)
Sets the CORS for the specified Bos bucket.

Parameters:
request - The request object containing the CORS to set into specified bucket.

getBucketCros

public GetBucketCorsResponse getBucketCros(GetBucketCorsRequest request)
Gets the CORS for the specified Bos bucket.

Parameters:
request - The request object containing the specified bucket to get bucket CORS.

deleteBucketCors

public void deleteBucketCors(DeleteBucketCorsRequest request)
Delete the CORS for the specified Bos bucket.

Parameters:
request - The request object containing the specified bucket to delete bucket CORS.

setBucketBucketLifecycle

public void setBucketBucketLifecycle(SetBucketLifecycleRequest request)
Sets the Lifecycle for the specified Bos bucket.

Parameters:
request - The request object containing the Lifecycle to set into specified bucket.

getBucketLifecycle

public GetBucketLifecycleResponse getBucketLifecycle(GetBucketLifecycleRequest request)
Gets Lifecycle for the specified Bos bucket.

Parameters:
request - The request object containing the specified bucket to get bucket Lifecycle.

deleteBucketLifecycle

public void deleteBucketLifecycle(DeleteBucketLifecycleRequest request)
Delete the Lifecycle for the specified Bos bucket.

Parameters:
request - The request object containing the specified bucket to delete bucket Lifecycle.

deleteBucket

public void deleteBucket(String bucketName)
Deletes the specified bucket. All objects in the bucket must be deleted before the bucket itself can be deleted.

Only the owner of a bucket can delete it, regardless of the bucket's access control policy.

Parameters:
bucketName - The name of the bucket to delete.

deleteBucket

public void deleteBucket(DeleteBucketRequest request)
Deletes the specified bucket. All objects in the bucket must be deleted before the bucket itself can be deleted.

Only the owner of a bucket can delete it, regardless of the bucket's access control policy.

Parameters:
request - The request object containing all options for deleting a Bos bucket.

generatePresignedUrl

public URL generatePresignedUrl(String bucketName,
                                String key,
                                int expirationInSeconds)
Returns a pre-signed URL for accessing a Bos resource.

Parameters:
bucketName - The name of the bucket containing the desired object.
key - The key in the specified bucket under which the desired object is stored.
expirationInSeconds - The expiration after which the returned pre-signed URL will expire.
Returns:
A pre-signed URL which expires at the specified time, and can be used to allow anyone to download the specified object from Bos, without exposing the owner's Bce secret access key.

generatePresignedUrl

public URL generatePresignedUrl(String bucketName,
                                String key,
                                int expirationInSeconds,
                                HttpMethodName method)
Returns a pre-signed URL for accessing a Bos resource.

Parameters:
bucketName - The name of the bucket containing the desired object.
key - The key in the specified bucket under which the desired object is stored.
expirationInSeconds - The expiration after which the returned pre-signed URL will expire.
method - The HTTP method verb to use for this URL
Returns:
A pre-signed URL which expires at the specified time, and can be used to allow anyone to download the specified object from Bos, without exposing the owner's Bce secret access key.

generatePresignedUrl

public URL generatePresignedUrl(GeneratePresignedUrlRequest request)
Returns a pre-signed URL for accessing a Bos resource.

Parameters:
request - The request object containing all the options for generating a pre-signed URL (bucket name, key, expiration date, etc).
Returns:
A pre-signed URL which expires at the specified time, and can be used to allow anyone to download the specified object from Bos, without exposing the owner's Bce secret access key.

listObjects

public ListObjectsResponse listObjects(String bucketName)
Returns ListObjectsResponse containing a list of summary information about the objects in the specified buckets. List results are always returned in lexicographic (alphabetical) order.

Parameters:
bucketName - The name of the Bos bucket to list.
Returns:
ListObjectsResponse containing a listing of the objects in the specified bucket, along with any other associated information, such as common prefixes (if a delimiter was specified), the original request parameters, etc.

listObjects

public ListObjectsResponse listObjects(String bucketName,
                                       String prefix)
Returns ListObjectsResponse containing a list of summary information about the objects in the specified buckets. List results are always returned in lexicographic (alphabetical) order.

Parameters:
bucketName - The name of the Bos bucket to list.
prefix - An optional parameter restricting the response to keys beginning with the specified prefix. Use prefixes to separate a bucket into different sets of keys, similar to how a file system organizes files into directories.
Returns:
ListObjectsResponse containing a listing of the objects in the specified bucket, along with any other associated information, such as common prefixes (if a delimiter was specified), the original request parameters, etc.

listObjects

public ListObjectsResponse listObjects(ListObjectsRequest request)
Returns ListObjectsResponse containing a list of summary information about the objects in the specified buckets. List results are always returned in lexicographic (alphabetical) order.

Parameters:
request - The request object containing all options for listing the objects in a specified bucket.
Returns:
ListObjectsResponse containing a listing of the objects in the specified bucket, along with any other associated information, such as common prefixes (if a delimiter was specified), the original request parameters, etc.

listNextBatchOfObjects

public ListObjectsResponse listNextBatchOfObjects(ListObjectsResponse previousResponse)
Provides an easy way to continue a truncated object listing and retrieve the next page of results.

Parameters:
previousResponse - The previous truncated ListObjectsResponse. If a non-truncated ListObjectsResponse is passed in, an empty ListObjectsResponse is returned without ever contacting Bos.
Returns:
The next set of ListObjectsResponse results, beginning immediately after the last result in the specified previous ListObjectsResponse.

getObject

public BosObject getObject(String bucketName,
                           String key)
Gets the object stored in Bos under the specified bucket and key.

Parameters:
bucketName - The name of the bucket containing the desired object.
key - The key under which the desired object is stored.
Returns:
The object stored in Bos in the specified bucket and key.

getObject

public ObjectMetadata getObject(String bucketName,
                                String key,
                                File destinationFile)
Gets the object metadata for the object stored in Bos under the specified bucket and key, and saves the object contents to the specified file. Returns null if the specified constraints weren't met.

Parameters:
bucketName - The name of the bucket containing the desired object.
key - The key under which the desired object is stored.
destinationFile - Indicates the file (which might already exist) where to save the object content being downloading from Bos.
Returns:
All Bos object metadata for the specified object. Returns null if constraints were specified but not met.

getObject

public BosObject getObject(GetObjectRequest request)
Gets the object stored in Bos under the specified bucket and key.

Parameters:
request - The request object containing all the options on how to download the object.
Returns:
The object stored in Bos in the specified bucket and key.

getObject

public ObjectMetadata getObject(GetObjectRequest request,
                                File destinationFile)
Gets the object metadata for the object stored in Bos under the specified bucket and key, and saves the object contents to the specified file. Returns null if the specified constraints weren't met.

Parameters:
request - The request object containing all the options on how to download the Bos object content.
destinationFile - Indicates the file (which might already exist) where to save the object content being downloading from Bos.
Returns:
All Bos object metadata for the specified object. Returns null if constraints were specified but not met.

getObjectContent

public byte[] getObjectContent(String bucketName,
                               String key)
Gets the object content stored in Bos under the specified bucket and key.

Parameters:
bucketName - The name of the bucket containing the desired object.
key - The key under which the desired object is stored.
Returns:
The object content stored in Bos in the specified bucket and key.

getObjectContent

public byte[] getObjectContent(GetObjectRequest request)
Gets the object content stored in Bos under the specified bucket and key.

Parameters:
request - The request object containing all the options on how to download the Bos object content.
Returns:
The object content stored in Bos in the specified bucket and key.

getObjectMetadata

public ObjectMetadata getObjectMetadata(String bucketName,
                                        String key)
Gets the metadata for the specified Bos object without actually fetching the object itself. This is useful in obtaining only the object metadata, and avoids wasting bandwidth on fetching the object data.

The object metadata contains information such as content type, content disposition, etc., as well as custom user metadata that can be associated with an object in Bos.

Parameters:
bucketName - The name of the bucket containing the object's whose metadata is being retrieved.
key - The key of the object whose metadata is being retrieved.
Returns:
All Bos object metadata for the specified object.

getObjectMetadata

public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest request)
Gets the metadata for the specified Bos object without actually fetching the object itself. This is useful in obtaining only the object metadata, and avoids wasting bandwidth on fetching the object data.

The object metadata contains information such as content type, content disposition, etc., as well as custom user metadata that can be associated with an object in Bos.

Parameters:
request - The request object specifying the bucket, key whose metadata is being retrieved.
Returns:
All Bos object metadata for the specified object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   File file)
Uploads the specified file to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
file - The file containing the data to be uploaded to Bos.
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   File file,
                                   ObjectMetadata metadata)
Uploads the specified file and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
file - The file containing the data to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   String value)
Uploads the specified string to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The string containing the value to be uploaded to Bos.
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   String value,
                                   ObjectMetadata metadata)
Uploads the specified string and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The string containing the value to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   byte[] value)
Uploads the specified bytes to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The bytes containing the value to be uploaded to Bos.
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   byte[] value,
                                   ObjectMetadata metadata)
Uploads the specified bytes and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The bytes containing the value to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   InputStream input)
Uploads the specified input stream to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
input - The input stream containing the value to be uploaded to Bos.
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(String bucketName,
                                   String key,
                                   InputStream input,
                                   ObjectMetadata metadata)
Uploads the specified input stream and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
input - The input stream containing the value to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

putObject

public PutObjectResponse putObject(PutObjectRequest request)
Uploads a new object to the specified Bos bucket. The PutObjectRequest contains all the details of the request, including the bucket to upload to, the key the object will be uploaded under, and the file or input stream containing the data to upload.

Parameters:
request - The request object containing all the parameters to upload a new object to Bos.
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.

copyObject

public CopyObjectResponse copyObject(String sourceBucketName,
                                     String sourceKey,
                                     String destinationBucketName,
                                     String destinationKey)
Copies a source object to a new destination in Bos.

Parameters:
sourceBucketName - The name of the bucket containing the source object to copy.
sourceKey - The key in the source bucket under which the source object is stored.
destinationBucketName - The name of the bucket in which the new object will be created. This can be the same name as the source bucket's.
destinationKey - The key in the destination bucket under which the new object will be created.
Returns:
A CopyObjectResponse object containing the information returned by Bos for the newly created object.

copyObject

public CopyObjectResponse copyObject(CopyObjectRequest request)
Copies a source object to a new destination in Bos.

Parameters:
request - The request object containing all the options for copying an Bos object.
Returns:
A CopyObjectResponse object containing the information returned by Bos for the newly created object.

fetchObject

public FetchObjectResponse fetchObject(String bucketName,
                                       String key,
                                       String sourceUrl)
Fetches a source object to a new destination in Bos.

Parameters:
bucketName - The name of the bucket in which the new object will be created.
key - The key in the destination bucket under which the new object will be created.
sourceUrl - The url full path for fetching.
Returns:
A FetchObjectResponse object containing the information returned by Bos for the newly fetching.

fetchObject

public FetchObjectResponse fetchObject(String bucketName,
                                       String key,
                                       String sourceUrl,
                                       String mode)
Fetches a source object to a new destination in Bos.

Parameters:
bucketName - The name of the bucket in which the new object will be created.
key - The key in the destination bucket under which the new object will be created.
sourceUrl - The url full path for fetching.
mode - The mode path for fetching.
Returns:
A FetchObjectResponse object containing the information returned by Bos for the newly fetching.

fetchObject

public FetchObjectResponse fetchObject(FetchObjectRequest request)
Fetches a source object to a new destination in Bos.

Parameters:
request - The request object containing all the options for fetching url to a Bos object.
Returns:
A FetchObjectResponse object containing the information returned by Bos for the newly fetching.

deleteObject

public void deleteObject(String bucketName,
                         String key)
Deletes the specified object in the specified bucket.

Parameters:
bucketName - The name of the Bos bucket containing the object to delete.
key - The key of the object to delete.

deleteObject

public void deleteObject(DeleteObjectRequest request)
Deletes the specified object in the specified bucket.

Parameters:
request - The request object containing all options for deleting a Bos object.

deleteMultipleObjects

public DeleteMultipleObjectsResponse deleteMultipleObjects(DeleteMultipleObjectsRequest request)
Deletes the multiple specified objects in the specified bucket.

Parameters:
request - The request object containing all options for deleting a Bos multiple objects.

setObjectAcl

public void setObjectAcl(String bucketName,
                         String objectKey,
                         String jsonObjectAcl)
Set Object Acl for specified object in the specified bucket.

Parameters:
bucketName -
objectKey -
jsonObjectAcl - The json format of specified object.

setObjectAcl

public void setObjectAcl(String bucketName,
                         String objectKey,
                         CannedAccessControlList acl)
Set Object Acl for specified object in the specified bucket.

Parameters:
bucketName -
objectKey -
acl - The CannedAccessControlList of specified object.

setObjectAcl

public void setObjectAcl(SetObjectAclRequest request)
Set Object Acl for specified object in the specified bucket.

Parameters:
request - The request object containing all options for setting a Bos object acl.

getObjectAcl

public GetObjectAclResponse getObjectAcl(GetObjectAclRequest request)
Get Object Acl for specified object in the specified bucket.

Parameters:
request - The request object containing all options for getting a Bos object acl.

deleteObjectAcl

public void deleteObjectAcl(DeleteObjectAclRequest request)
Delete Object Acl for specified object in the specified bucket.

Parameters:
request - The request object containing all options for deleting a Bos object acl.

initiateMultipartUpload

public InitiateMultipartUploadResponse initiateMultipartUpload(String bucketName,
                                                               String key)
Initiates a multipart upload and returns an InitiateMultipartUploadResponse which contains an upload ID. This upload ID associates all the parts in the specific upload and is used in each of your subsequent uploadPart requests. You also include this upload ID in the final request to either complete, or abort the multipart upload request.

Parameters:
bucketName - The name of the Bos bucket containing the object to initiate.
key - The key of the object to initiate.
Returns:
An InitiateMultipartUploadResponse from Bos.

initiateMultipartUpload

public InitiateMultipartUploadResponse initiateMultipartUpload(InitiateMultipartUploadRequest request)
Initiates a multipart upload and returns an InitiateMultipartUploadResponse which contains an upload ID. This upload ID associates all the parts in the specific upload and is used in each of your subsequent uploadPart requests. You also include this upload ID in the final request to either complete, or abort the multipart upload request.

Parameters:
request - The InitiateMultipartUploadRequest object that specifies all the parameters of this operation.
Returns:
An InitiateMultipartUploadResponse from Bos.

uploadPart

public UploadPartResponse uploadPart(UploadPartRequest request)
Uploads a part in a multipart upload. You must initiate a multipart upload before you can upload any part.

Parameters:
request - The UploadPartRequest object that specifies all the parameters of this operation.
Returns:
An UploadPartResponse from Bos containing the part number and ETag of the new part.

uploadPartCopy

public UploadPartCopyResponse uploadPartCopy(UploadPartCopyRequest request)
Uploads a copy part in a multipart upload. You must initiate a multipart upload before you can upload any part.

Parameters:
request - The UploadPartCopyRequest object that specifies all the parameters of this operation.
Returns:
An UploadPartCopyResponse from Bos containing the part number and ETag of the new part.

listParts

public ListPartsResponse listParts(String bucketName,
                                   String key,
                                   String uploadId)
Lists the parts that have been uploaded for a specific multipart upload.

Parameters:
bucketName - The name of the bucket containing the multipart upload whose parts are being listed.
key - The key of the associated multipart upload whose parts are being listed.
uploadId - The ID of the multipart upload whose parts are being listed.
Returns:
Returns a ListPartsResponse from Bos.

listParts

public ListPartsResponse listParts(ListPartsRequest request)
Lists the parts that have been uploaded for a specific multipart upload.

Parameters:
request - The ListPartsRequest object that specifies all the parameters of this operation.
Returns:
Returns a ListPartsResponse from Bos.

completeMultipartUpload

public CompleteMultipartUploadResponse completeMultipartUpload(String bucketName,
                                                               String key,
                                                               String uploadId,
                                                               List<PartETag> partETags)
Completes a multipart upload by assembling previously uploaded parts.

Parameters:
bucketName - The name of the bucket containing the multipart upload to complete.
key - The key of the multipart upload to complete.
uploadId - The ID of the multipart upload to complete.
partETags - The list of part numbers and ETags to use when completing the multipart upload.
Returns:
A CompleteMultipartUploadResponse from Bos containing the ETag for the new object composed of the individual parts.

completeMultipartUpload

public CompleteMultipartUploadResponse completeMultipartUpload(String bucketName,
                                                               String key,
                                                               String uploadId,
                                                               List<PartETag> partETags,
                                                               ObjectMetadata metadata)
Completes a multipart upload by assembling previously uploaded parts.

Parameters:
bucketName - The name of the bucket containing the multipart upload to complete.
key - The key of the multipart upload to complete.
uploadId - The ID of the multipart upload to complete.
partETags - The list of part numbers and ETags to use when completing the multipart upload.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
A CompleteMultipartUploadResponse from Bos containing the ETag for the new object composed of the individual parts.

completeMultipartUpload

public CompleteMultipartUploadResponse completeMultipartUpload(CompleteMultipartUploadRequest request)
Completes a multipart upload by assembling previously uploaded parts.

Parameters:
request - The CompleteMultipartUploadRequest object that specifies all the parameters of this operation.
Returns:
A CompleteMultipartUploadResponse from Bos containing the ETag for the new object composed of the individual parts.

abortMultipartUpload

public void abortMultipartUpload(String bucketName,
                                 String key,
                                 String uploadId)
Aborts a multipart upload. After a multipart upload is aborted, no additional parts can be uploaded using that upload ID. The storage consumed by any previously uploaded parts will be freed. However, if any part uploads are currently in progress, those part uploads may or may not succeed. As a result, it may be necessary to abort a given multipart upload multiple times in order to completely free all storage consumed by all parts.

Parameters:
bucketName - The name of the bucket containing the multipart upload to abort.
key - The key of the multipart upload to abort.
uploadId - The ID of the multipart upload to abort.

abortMultipartUpload

public void abortMultipartUpload(AbortMultipartUploadRequest request)
Aborts a multipart upload. After a multipart upload is aborted, no additional parts can be uploaded using that upload ID. The storage consumed by any previously uploaded parts will be freed. However, if any part uploads are currently in progress, those part uploads may or may not succeed. As a result, it may be necessary to abort a given multipart upload multiple times in order to completely free all storage consumed by all parts.

Parameters:
request - The AbortMultipartUploadRequest object that specifies all the parameters of this operation.

listMultipartUploads

public ListMultipartUploadsResponse listMultipartUploads(String bucketName)
Lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been initiated, using the InitiateMultipartUpload request, but has not yet been completed or aborted.

Parameters:
bucketName - The name of the bucket containing the uploads to list.
Returns:
A ListMultipartUploadsResponse from Bos.

listMultipartUploads

public ListMultipartUploadsResponse listMultipartUploads(ListMultipartUploadsRequest request)
Lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been initiated, using the InitiateMultipartUpload request, but has not yet been completed or aborted.

Parameters:
request - The ListMultipartUploadsRequest object that specifies all the parameters of this operation.
Returns:
A ListMultipartUploadsResponse from Bos.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         File file)
Uploads the specified appendable file to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
file - The appendable file containing the data to be uploaded to Bos.
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         File file,
                                         ObjectMetadata metadata)
Uploads the specified appendable file to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
file - The file containing the data to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         String value)
Uploads the specified string to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The string containing the value to be uploaded to Bos.
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         String value,
                                         ObjectMetadata metadata)
Uploads the specified string and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The string containing the value to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         byte[] value)
Uploads the specified bytes to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The bytes containing the value to be uploaded to Bos.
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         byte[] value,
                                         ObjectMetadata metadata)
Uploads the appendable bytes and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
value - The bytes containing the value to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         InputStream input)
Uploads the appendable input stream to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
input - The input stream containing the value to be uploaded to Bos.
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(String bucketName,
                                         String key,
                                         InputStream input,
                                         ObjectMetadata metadata)
Uploads the appendable input stream and object metadata to Bos under the specified bucket and key name.

Parameters:
bucketName - The name of an existing bucket, to which you have Write permission.
key - The key under which to store the specified file.
input - The input stream containing the value to be uploaded to Bos.
metadata - Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.

appendObject

public AppendObjectResponse appendObject(AppendObjectRequest request)
Uploads a new object to the specified Bos bucket. The AppendObjectRequest contains all the details of the request, including the bucket to upload to, the key the object will be uploaded under, and the file or input stream containing the data to upload.

Parameters:
request - The request object containing all the parameters to upload a new appendable object to Bos.
Returns:
An AppendObjectResponse object containing the information returned by Bos for the newly created object.


Copyright © 2018. All rights reserved.