com.netease.cloud.services.nos
public interface Nos
The interface for accessing the Netease NOS web service.
Netease NOS provides storage service on the Internet.
This NOS Java SDK provides a simple interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web.
Modifier and Type | Method and Description |
---|---|
void |
abortMultipartUpload(AbortMultipartUploadRequest request)
Aborts a multipart upload.
|
CompleteMultipartUploadResult |
completeMultipartUpload(CompleteMultipartUploadRequest request)
Completes a multipart upload by assembling previously uploaded parts.
|
void |
copyObject(CopyObjectRequest copyObjectRequest)
Copies a source object to a new destination in NOS.
|
void |
copyObject(String sourceBucketName,
String sourceKey,
String destinationBucketName,
String destinationKey)
Copies a source object to a new destination in NOS.
|
Bucket |
createBucket(CreateBucketRequest createBucketRequest)
Creates a new NOS bucket ,and you can specified the region,ACL,and
whether this bucket is deduplicate supported or not.
|
Bucket |
createBucket(String bucketName)
Creates a new NOS bucket in the default region,
Region.CN_Hnagzhou .and default ACL
CannedAccessControlList.Private ,and default deduplicate status
DeduplicateStatus#Disabled |
Bucket |
createBucket(String bucketName,
Region region)
Creates a new NOS bucket with the specified name in the specified
region,and is supported dedupicate or not.
|
Bucket |
createBucket(String bucketName,
String region)
Creates a new NOS bucket with the specified name in the specified
region,and is supported dedupicate or not.
|
void |
deleteBucket(DeleteBucketRequest deleteBucketRequest)
Deletes the specified bucket.
|
void |
deleteBucket(String bucketName)
Deletes the specified bucket.
|
void |
deleteBucketLifecycleConfiguration(String bucketName)
Removes the lifecycle configuration for the bucket specified.
|
void |
deleteObject(DeleteObjectRequest deleteObjectRequest)
Deletes the specified object in the specified bucket.
|
void |
deleteObject(String bucketName,
String key)
Deletes the specified object in the specified bucket.
|
DeleteObjectsResult |
deleteObjects(DeleteObjectsRequest deleteObjectsRequest)
Deletes multiple objects in a single bucket from NOS.
|
boolean |
doesBucketExist(String bucketName)
See if the specified bucket exists.
|
boolean |
doesObjectExist(String bucketName,
String key)
See if the specified object exists.
|
URL |
generatePresignedUrl(GeneratePresignedUrlRequest generatePresignedUrlRequest)
Returns a pre-signed URL for accessing an NOS resource.
|
URL |
generatePresignedUrl(String bucketName,
String key,
Date expiration)
Returns a pre-signed URL for accessing an NOS resource.
|
URL |
generatePresignedUrl(String bucketName,
String key,
Date expiration,
HttpMethod method)
Returns a pre-signed URL for accessing an NOS resource.
|
CannedAccessControlList |
getBucketAcl(GetBucketAclRequest getBucketAclRequest)
Gets the (ACL) of the specified bucket,Each bucket has an ACL that
defines its access control policy.
|
CannedAccessControlList |
getBucketAcl(String bucketName)
Gets the
CannedAccessControlList (ACL) of the specified
bucket,Each bucket has an ACL that defines its access control policy. |
BucketLifecycleConfiguration |
getBucketLifecycleConfiguration(String bucketName)
Gets the lifecycle configuration for the specified bucket.
|
String |
getBucketLocation(GetBucketLocationRequest getBucketLocationRequest)
Gets the geographical region where Nos stores the specified bucket.
|
String |
getBucketLocation(String bucketName)
Gets the geographical region where Nos stores the specified bucket.
|
GetBucketStatsResult |
getBucketStats(String bucketName)
Gets the stats(objectCount, storageCapacity, deduplicationRate) for the bucket specified.
|
NOSObject |
getObject(GetObjectRequest getObjectRequest)
Gets the object stored in NOS under the specified bucket and key.
|
ObjectMetadata |
getObject(GetObjectRequest getObjectRequest,
File destinationFile)
Gets the object metadata for the object stored in NOS under the specified
bucket and key, and saves the object contents to the specified file.
|
NOSObject |
getObject(String bucketName,
String key)
Gets the object stored in NOS under the specified bucket and key.
|
ObjectMetadata |
getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest)
Gets the metadata for the specified object without actually fetching the
object itself.
|
ObjectMetadata |
getObjectMetadata(String bucketName,
String key)
Gets the metadata for the specified object without actually fetching the
object itself.
|
InitiateMultipartUploadResult |
initiateMultipartUpload(InitiateMultipartUploadRequest request)
Initiates a multipart upload and returns an InitiateMultipartUploadResult
which contains an upload ID.
|
List<Bucket> |
listBuckets()
List your all buckets owned by you.
|
List<Bucket> |
listBuckets(ListBucketsRequest listBucketsRequest) |
MultipartUploadListing |
listMultipartUploads(ListMultipartUploadsRequest request)
Lists in-progress multipart uploads.
|
ObjectListing |
listObjects(ListObjectsRequest listObjectsRequest)
According to some query condition to return a list of summary information
about the objects in the specified buckets.
|
ObjectListing |
listObjects(String bucketName)
Returns a list of summary information about the objects in the specified
buckets.
|
PartListing |
listParts(ListPartsRequest request)
Lists the parts that have been uploaded for a specific multipart upload.
|
void |
moveObject(MoveObjectRequest moveObjectRequest)
move a source object to a new destination in NOS.
|
void |
moveObject(String sourceBucketName,
String sourceKey,
String destinationBucketName,
String destinationKey)
move a source object to a new destination in NOS.
|
PutObjectResult |
putObject(PutObjectRequest putObjectRequest)
Uploads a new object to the specified NOS bucket.
|
PutObjectResult |
putObject(String bucketName,
String key,
File file)
Uploads the specified file to NOS under the specified bucket and key
name.
|
PutObjectResult |
putObject(String bucketName,
String key,
InputStream input,
ObjectMetadata metadata)
Uploads the specified input stream and object metadata to NOS under the
specified bucket and key name.
|
void |
putObjectMeta(String bucketName,
String key,
ObjectMetadata metadata) |
void |
setBucketAcl(SetBucketAclRequest setBucketAclRequest)
Sets the
CannedAccessControlList (ACL)for the specified
bucket,Each bucket has an ACL that defines its access control policy.if
the ACL is private,anybody expect you can access objects in the bucket,if
the ACL is private-read,then others can download the objects in this
bucket. |
void |
setBucketAcl(String bucketName,
CannedAccessControlList acl)
Sets the
CannedAccessControlList (ACL)for the specified
bucket,Each bucket has an ACL that defines its access control policy.if
the ACL is private,anybody expect you can access objects in the bucket,if
the ACL is private-read,then others can download the objects in this
bucket. |
void |
setBucketLifecycleConfiguration(SetBucketLifecycleConfigurationRequest setBucketLifecycleConfigurationRequest)
Sets the lifecycle configuration for the specified bucket.
|
void |
setBucketLifecycleConfiguration(String bucketName,
BucketLifecycleConfiguration bucketLifecycleConfiguration)
Sets the lifecycle configuration for the specified bucket.
|
void |
shutdown()
Shuts down this client object, releasing any resources that might be held
open.
|
UploadPartResult |
uploadPart(UploadPartRequest request)
Uploads a part in a multipart upload.
|
ObjectListing listObjects(String bucketName) throws ClientException, ServiceException
Returns a list of summary information about the objects in the specified buckets. List results are always returned in alphabetical order.
bucketName
- The name of the bucket to be listed.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.ObjectListing listObjects(ListObjectsRequest listObjectsRequest) throws ClientException, ServiceException
According to some query condition to return a list of summary information about the objects in the specified buckets.
listObjectsRequest
- The request object containing all query conditions for listing
the objects in a specified bucket.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.listObjects(String)
boolean doesObjectExist(String bucketName, String key) throws ClientException, ServiceException
See if the specified object exists.
bucketName
- The name of the bucket will to be checked.key
- The name of the object will to be checked.true
if the specified object exists in NOS;
otherwise return false
.ClientException
- If any errors are occured in the client point. If any errors
occurred in NOS server point.ServiceException
boolean doesBucketExist(String bucketName) throws ClientException, ServiceException
See if the specified bucket exists. Note:bucket in NOS is unique globally,It's mean that if someone has create a bucket ,anybody can't to create the bucket with the same bucket name.
bucketName
- The name of the bucket will to be checked.true
if the specified bucket exists in NOS;
otherwise return false
.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.List<Bucket> listBuckets() throws ClientException, ServiceException
List your all buckets owned by you.
ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.List<Bucket> listBuckets(ListBucketsRequest listBucketsRequest) throws ClientException, ServiceException
ClientException
ServiceException
listBuckets()
Bucket createBucket(CreateBucketRequest createBucketRequest) throws ClientException, ServiceException
Creates a new NOS bucket ,and you can specified the region,ACL,and whether this bucket is deduplicate supported or not.
createBucketRequest
- The request object containing all options for creating an NOS
bucket.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.createBucket(String)
Bucket createBucket(String bucketName) throws ClientException, ServiceException
Creates a new NOS bucket in the default region,
Region.CN_Hnagzhou
.and default ACL
CannedAccessControlList.Private
,and default deduplicate status
DeduplicateStatus#Disabled
bucketName
- The name of the bucket to create. All buckets in NOS share a
single namespace; ensure the bucket is given a unique name. In
addition,the bucket name must follow orders:
ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.createBucket(CreateBucketRequest)
Bucket createBucket(String bucketName, Region region) throws ClientException, ServiceException
Creates a new NOS bucket with the specified name in the specified region,and is supported dedupicate or not.
bucketName
- The name of the bucket to create. All buckets in NOS share a
single namespace; ensure the bucket is given a unique name. In
addition,the bucket name must follow orders:
region
- The region in which to create the new bucket.deduplicate
- If the value is true
then this bucket will
deduplicate supported, means if you want to upload an existed
object in this bucket,it's not be to upload repeatedly.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointBucket createBucket(String bucketName, String region) throws ClientException, ServiceException
Creates a new NOS bucket with the specified name in the specified region,and is supported dedupicate or not.
bucketName
- The name of the bucket to create. All buckets in NOS share a
single namespace; ensure the bucket is given a unique name. In
addition,the bucket name must follow orders:
region
- The NOS region in which to create the new bucket. String value
of Region
.deduplicate
- If the value is true
then this bucket will
deduplicate supported, means if you want to upload an existed
object in this bucket,it's not be to upload repeatedly.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointCannedAccessControlList getBucketAcl(String bucketName) throws ClientException, ServiceException
Gets the CannedAccessControlList
(ACL) of the specified
bucket,Each bucket has an ACL that defines its access control policy.
bucketName
- The name of the bucket whose ACL is being retrieved.CannedAccessControlList
for the specified NOS
bucket.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointvoid setBucketAcl(SetBucketAclRequest setBucketAclRequest) throws ClientException, ServiceException
Sets the CannedAccessControlList
(ACL)for the specified
bucket,Each bucket has an ACL that defines its access control policy.if
the ACL is private,anybody expect you can access objects in the bucket,if
the ACL is private-read,then others can download the objects in this
bucket.
setBucketAclRequest
- The request object containing the bucket to modify and the ACL
to set.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointCannedAccessControlList getBucketAcl(GetBucketAclRequest getBucketAclRequest) throws ClientException, ServiceException
Gets the (ACL) of the specified bucket,Each bucket has an ACL that defines its access control policy.
getBucketAclRequest
- The request containing the name of the bucket whose ACL is
being retrieved.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointvoid setBucketAcl(String bucketName, CannedAccessControlList acl) throws ClientException, ServiceException
Sets the CannedAccessControlList
(ACL)for the specified
bucket,Each bucket has an ACL that defines its access control policy.if
the ACL is private,anybody expect you can access objects in the bucket,if
the ACL is private-read,then others can download the objects in this
bucket.
bucketName
- The name of the bucket whose ACL is being set.acl
- The pre-configured CannedAccessControlLists
to
set for the specified bucket.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointString getBucketLocation(String bucketName) throws ClientException, ServiceException
Gets the geographical region where Nos stores the specified bucket.
To view the location constraint of a bucket, the user must be the bucket owner.
Note that Region
enumeration values are not returned
directly from this method.
bucketName
- The name of the Nos bucket to look up. This must be a bucket
the user owns.ClientException
- If any errors are encountered in the client point.ServiceException
- If any errors occurred in the server point.String getBucketLocation(GetBucketLocationRequest getBucketLocationRequest) throws ClientException, ServiceException
Gets the geographical region where Nos stores the specified bucket.
To view the location constraint of a bucket, the user must be the bucket owner.
Note that Region
enumeration values are not returned
directly from this method.
getBucketLocationRequest
- The request object containing the name of the Nos bucket to
look up. This must be a bucket the user owns.ClientException
- If any errors are encountered in the client point.ServiceException
- If any errors occurred in the server point.ObjectMetadata getObjectMetadata(String bucketName, String key) throws ClientException, ServiceException
Gets the metadata for the specified 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.
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.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointgetObjectMetadata(GetObjectMetadataRequest)
ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) throws ClientException, ServiceException
Gets the metadata for the specified 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.
getObjectMetadataRequest
- The request object specifying the bucket, key and optional
version ID of the object whose metadata is being retrieved.ClientException
- If any errors are encountered on the client while making the
request orServiceException
- If any errors occurred in NOS server pointgetObjectMetadata(String, String)
NOSObject getObject(String bucketName, String key) throws ClientException, ServiceException
Gets the object stored in NOS under the specified bucket and key.
Be extremely careful when using this method; the returned NOS object contains a direct stream of data from the HTTP connection. The underlying HTTP connection cannot be closed until the user finishes reading the data and closes the stream. Therefore:
If the object fetched is publicly readable, it can also read it by pasting its URL into a browser.
For more advanced options (such as downloading only a range of an
object's content, or placing constraints on when the object should be
downloaded) callers can use getObject(GetObjectRequest)
.
bucketName
- The name of the bucket containing the desired object.key
- The key under which the desired object is stored.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointgetObject(GetObjectRequest)
,
getObject(GetObjectRequest, File)
NOSObject getObject(GetObjectRequest getObjectRequest) throws ClientException, ServiceException
Gets the object stored in NOS under the specified bucket and key. Returns
null
if the specified constraints weren't met.
Callers should be very careful when using this method; the returned NOS object contains a direct stream of data from the HTTP connection. The underlying HTTP connection cannot be closed until the user finishes reading the data and closes the stream. Callers should therefore:
If callers do not follow those rules, then the client can run out of resources if allocating too many open, but unused, HTTP connections.
If the object fetched is publicly readable, it can also read it by pasting its URL into a browser.
When specifying constraints in the request object, the client needs to be
prepared to handle this method returning null
if the
provided constraints aren't met when NOS receives the request.
If the advanced options provided in GetObjectRequest
aren't
needed, use the simpler
getObject(String bucketName, String key)
method.
getObjectRequest
- The request object containing all the options on how to
download the object.null
if constraints were specified but not met.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointgetObject(String, String)
,
getObject(GetObjectRequest, File)
ObjectMetadata getObject(GetObjectRequest getObjectRequest, File destinationFile) throws ClientException, ServiceException
Gets the object metadata for the object stored in NOS under the specified
bucket and key, and saves the object contents to the specified file.
Returns null
if the specified constraints weren't met.
Instead of using getObject(GetObjectRequest)
, use this method
to ensure that the underlying HTTP stream resources are automatically
closed as soon as possible. The NOS clients handles immediate storage of
the object contents to the specified file.
If the object fetched is publicly readable, it can also read it by pasting its URL into a browser.
When specifying constraints in the request object, the client needs to be
prepared to handle this method returning null
if the
provided constraints aren't met when NOS receives the request.
getObjectRequest
- The request object containing all the options on how to
download the NOS object content.destinationFile
- Indicates the file (which might already exist) where to save
the object content being downloading from NOS.null
if constraints were specified but not met.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointgetObject(String, String)
,
getObject(GetObjectRequest)
void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws ClientException, ServiceException
Deletes the specified bucket. All objects (and all object versions, if versioning was ever enabled) 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 (ACL).
deleteBucketRequest
- The request object containing all options for deleting an NOS
bucket.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointdeleteBucket(String)
void deleteBucket(String bucketName) throws ClientException, ServiceException
Deletes the specified bucket. All objects (and all object versions, if versioning was ever enabled) 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.
bucketName
- The name of the bucket to delete.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointdeleteBucket(String)
PutObjectResult putObject(PutObjectRequest putObjectRequest) throws ClientException, ServiceException
Uploads a new object to the specified NOS 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.
NOS never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored.
Depending on whether a file or input stream is being uploaded, this method has slightly different behavior.
When uploading a file:
When uploading directly from an input stream:
If versioning is enabled for the specified bucket, this operation will
never overwrite an existing object with the same key, but will keep the
existing object as an older version until that version is explicitly
deleted (see Nos#deleteVersion(String, String, String)
.
If versioning is not enabled, this operation will overwrite an existing object with the same key; NOS will store the last write request. NOS does not provide object locking. If NOS receives multiple write requests for the same object nearly simultaneously, all of the objects might be stored. However, a single object will be stored with the final write request.
When specifying a location constraint when creating a bucket, all objects added to the bucket are stored in the bucket's region. For example, if specifying a Europe (EU) region constraint for a bucket, all of that bucket's objects are stored in the EU region.
putObjectRequest
- The request object containing all the parameters to upload a
new object to NOS.PutObjectResult
object containing the information
returned by NOS for the newly created object.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointputObject(String, String, File)
,
putObject(String, String, InputStream, ObjectMetadata)
PutObjectResult putObject(String bucketName, String key, File file) throws ClientException, ServiceException
Uploads the specified file to NOS under the specified bucket and key name.
NOS never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored.
The client automatically computes a checksum of the file. NOS uses checksums to validate the data in each file.
Using the file extension, NOS attempts to determine the correct content type and content disposition to use for the object.
If versioning is enabled for the specified bucket, this operation will
this operation will never overwrite an existing object with the same key,
but will keep the existing object as an older version until that version
is explicitly deleted (see
Nos#deleteVersion(String, String, String)
.
If versioning is not enabled, this operation will overwrite an existing object with the same key; NOS will store the last write request. NOS does not provide object locking. If NOS receives multiple write requests for the same object nearly simultaneously, all of the objects might be stored. However, a single object will be stored with the final write request.
When specifying a location constraint when creating a bucket, all objects added to the bucket are stored in the bucket's region. For example, if specifying a Europe (EU) region constraint for a bucket, all of that bucket's objects are stored in EU region.
bucketName
- The name of an existing bucket, to which you havekey
- The key under which to store the specified file.file
- The file containing the data to be uploaded to NOS.PutObjectResult
object containing the information
returned by NOS for the newly created object.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointputObject(PutObjectRequest)
,
putObject(String, String, InputStream, ObjectMetadata)
PutObjectResult putObject(String bucketName, String key, InputStream input, ObjectMetadata metadata) throws ClientException, ServiceException
Uploads the specified input stream and object metadata to NOS under the specified bucket and key name.
NOS never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored.
The client automatically computes a checksum of the file. This checksum is verified against another checksum that is calculated once the data reaches NOS, ensuring the data has not corrupted in transit over the network.
Using the file extension, NOS attempts to determine the correct content type and content disposition to use for the object.
Content length must be specified before data can be uploaded to NOS. If the caller doesn't provide it, the library will have to buffer the contents of the input stream in order to calculate it because NOS explicitly requires that the content length be sent in the request headers before any of the data is sent.
If versioning is enabled for the specified bucket, this operation will
never overwrite an existing object at the same key, but instead will keep
the existing object around as an older version until that version is
explicitly deleted (see Nos#deleteVersion(String, String, String)
.
If versioning is not enabled, this operation will overwrite an existing object with the same key; NOS will store the last write request. NOS does not provide object locking. If NOS receives multiple write requests for the same object nearly simultaneously, all of the objects might be stored. However, a single object will be stored with the final write request.
When specifying a location constraint when creating a bucket, all objects added to the bucket are stored in the bucket's region. For example, if specifying a Europe (EU) region constraint for a bucket, all of that bucket's objects are stored in EU region.
bucketName
- The name of an existing bucket, to which you havekey
- The key under which to store the specified file.input
- The input stream containing the data to be uploaded to NOS.metadata
- Additional metadata instructing NOS how to handle the uploaded
data (e.g. custom user metadata, hooks for specifying content
type, etc.).PutObjectResult
object containing the information
returned by NOS for the newly created object.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointputObject(String, String, File)
,
putObject(PutObjectRequest)
void putObjectMeta(String bucketName, String key, ObjectMetadata metadata) throws ClientException, ServiceException
ClientException
ServiceException
void moveObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) throws ClientException, ServiceException
move a source object to a new destination in NOS.
To move an object, the caller's account must have read access to the source object and write access to the destination bucket
sourceBucketName
- The name of the bucket containing the source object to move.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.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointvoid moveObject(MoveObjectRequest moveObjectRequest) throws ClientException, ServiceException
move a source object to a new destination in NOS.
To move an object, the caller's account must have read access to the source object and write access to the destination bucket
moveObjectRequest
- The request object containing all the options for moving an
NOS object.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointvoid copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) throws ClientException, ServiceException
Copies a source object to a new destination in NOS.
By default, all object metadata for the source object are copied to the
new destination object. The NOS AcccessControlList
(ACL) is
not copied to the new object; the new object will have the default
NOS ACL, CannedAccessControlList.Private
.
To copy an object, the caller's account must have read access to the source object and write access to the destination bucket
This method only exposes the basic options for copying an NOS object.
Additional options are available by calling the
NosClient.copyObject(CopyObjectRequest)
method, including
conditional constraints for copying objects, setting ACLs, overwriting
object metadata, etc.
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.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointNosClient.copyObject(CopyObjectRequest)
void copyObject(CopyObjectRequest copyObjectRequest) throws ClientException, ServiceException
Copies a source object to a new destination in NOS.
By default, all object metadata for the source object are copied to the
new destination object, unless new object metadata in the specified
CopyObjectRequest
is provided.
The NOS Acccess Control List (ACL) is not copied to the new
object. The new object will have the default NOS ACL,
CannedAccessControlList.Private
, unless one is explicitly
provided in the specified CopyObjectRequest
.
To copy an object, the caller's account must have read access to the source object and write access to the destination bucket.
This method exposes all the advanced options for copying an NOS object.
For simple needs, use the
NosClient.copyObject(String, String, String, String)
method.
copyObjectRequest
- The request object containing all the options for copying an
NOS object.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointNosClient.copyObject(String, String, String, String)
void deleteObject(String bucketName, String key) throws ClientException, ServiceException
Deletes the specified object in the specified bucket. Once deleted, the object can only be restored if versioning was enabled when the object was deleted.
If attempting to delete an object that does not exist, NOS returns a success message instead of an error message.
bucketName
- The name of the NOS bucket containing the object to delete.key
- The key of the object to delete.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointNosClient.deleteObject(DeleteObjectRequest)
void deleteObject(DeleteObjectRequest deleteObjectRequest) throws ClientException, ServiceException
Deletes the specified object in the specified bucket. Once deleted, the object can only be restored if versioning was enabled when the object was deleted.
If attempting to delete an object that does not exist, NOS will return a success message instead of an error message.
deleteObjectRequest
- The request object containing all options for deleting an NOS
object.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointNosClient.deleteObject(String, String)
DeleteObjectsResult deleteObjects(DeleteObjectsRequest deleteObjectsRequest) throws ClientException, ServiceException
In some cases, some objects will be successfully deleted, while some
attempts will cause an error. If any object in the request cannot be
deleted, this method throws a MultiObjectDeleteException
with
details of the error.
deleteObjectsRequest
- The request object containing all options for deleting
multiple objects.MultiObjectDeleteException
- if one or more of the objects couldn't be deleted.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointURL generatePresignedUrl(String bucketName, String key, Date expiration) throws ClientException
Returns a pre-signed URL for accessing an NOS resource.
Pre-signed URLs allow clients to form a URL for an NOS resource, and then sign it with the current security credentials. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's security credentials.
Pre-signed URLs are useful in many situations where security credentials aren't available from the client that needs to make the actual request to NOS.
For example, an application may need remote users to upload files to the application owner's NOS bucket, but doesn't need to ship the security credentials with the application. A pre-signed URL to PUT an object into the owner's bucket can be generated from a remote location with the owner's security credentials, then the pre-signed URL can be passed to the end user's application to use.
bucketName
- The name of the bucket containing the desired object.key
- The key in the specified bucket under which the desired object
is stored.expiration
- The time at which the returned pre-signed URL will expire.ClientException
- If there were any problems pre-signing the request for the
specified NOS object.generatePresignedUrl(String, String, Date, HttpMethod)
,
generatePresignedUrl(GeneratePresignedUrlRequest)
URL generatePresignedUrl(String bucketName, String key, Date expiration, HttpMethod method) throws ClientException
Returns a pre-signed URL for accessing an NOS resource.
Pre-signed URLs allow clients to form a URL for an NOS resource, and then sign it with the current security credentials. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's security credentials.
Pre-signed URLs are useful in many situations where security credentials aren't available from the client that needs to make the actual request to NOS.
For example, an application may need remote users to upload files to the application owner's NOS bucket, but doesn't need to ship the security credentials with the application. A pre-signed URL to PUT an object into the owner's bucket can be generated from a remote location with the owner's security credentials, then the pre-signed URL can be passed to the end user's application to use.
bucketName
- The name of the bucket containing the desired object.key
- The key in the specified bucket under which the desired object
is stored.expiration
- The time at which the returned pre-signed URL will expire.method
- The HTTP method verb to use for this URLClientException
- If there were any problems pre-signing the request for the
specified NOS object.generatePresignedUrl(String, String, Date)
,
generatePresignedUrl(GeneratePresignedUrlRequest)
URL generatePresignedUrl(GeneratePresignedUrlRequest generatePresignedUrlRequest) throws ClientException
Returns a pre-signed URL for accessing an NOS resource.
Pre-signed URLs allow clients to form a URL for an NOS resource, and then sign it with the current security credentials. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's security credentials.
Pre-signed URLs are useful in many situations where security credentials aren't available from the client that needs to make the actual request to NOS.
For example, an application may need remote users to upload files to the application owner's NOS bucket, but doesn't need to ship the security credentials with the application. A pre-signed URL to PUT an object into the owner's bucket can be generated from a remote location with the owner's security credentials, then the pre-signed URL can be passed to the end user's application to use.
Note that presigned URLs cannot be used to upload an object with an attached policy, as described in this blog post. That method is only suitable for POSTs from HTML forms by browsers.
generatePresignedUrlRequest
- The request object containing all the options for generating a
pre-signed URL (bucket name, key, expiration date, etc).ClientException
- If there were any problems pre-signing the request for the
NOS resource.generatePresignedUrl(String, String, Date)
,
generatePresignedUrl(String, String, Date, HttpMethod)
InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request) throws ClientException, ServiceException
uploadPart(UploadPartRequest)
requests. You also include this
upload ID in the final request to either complete, or abort the multipart
upload request.request
- The InitiateMultipartUploadRequest object that specifies all
the parameters of this operation.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointUploadPartResult uploadPart(UploadPartRequest request) throws ClientException, ServiceException
Your UploadPart request must include an upload ID and a part number. The upload ID is the ID returned by NOS in response to your Initiate Multipart Upload request. Part number can be any number between 1 and 10,000, inclusive. A part number uniquely identifies a part and also defines its position within the object being uploaded. If you upload a new part using the same part number that was specified in uploading a previous part, the previously uploaded part is overwritten.
To ensure data is not corrupted traversing the network, specify the Content-MD5 header in the Upload Part request. NOS checks the part data against the provided MD5 value. If they do not match, NOS returns an error.
When you upload a part, the returned UploadPartResult contains an ETag property. You should record this ETag property value and the part number. After uploading all parts, you must send a CompleteMultipartUpload request. At that time NOS constructs a complete object by concatenating all the parts you uploaded, in ascending order based on the part numbers. The CompleteMultipartUpload request requires you to send all the part numbers and the corresponding ETag values.
request
- The UploadPartRequest object that specifies all the parameters
of this operation.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointPartListing listParts(ListPartsRequest request) throws ClientException, ServiceException
This method must include the upload ID, returned by the
initiateMultipartUpload(InitiateMultipartUploadRequest)
operation. This request returns a maximum of 1000 uploaded parts by
default. You can restrict the number of parts returned by specifying the
MaxParts property on the ListPartsRequest. If your multipart upload
consists of more parts than allowed in the ListParts response, the
response returns a IsTruncated field with value true, and a
NextPartNumberMarker property. In subsequent ListParts request you can
include the PartNumberMarker property and set its value to the
NextPartNumberMarker property value from the previous response.
request
- The ListPartsRequest object that specifies all the parameters
of this operation.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointvoid abortMultipartUpload(AbortMultipartUploadRequest request) throws ClientException, ServiceException
request
- The AbortMultipartUploadRequest object that specifies all the
parameters of this operation.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointCompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request) throws ClientException, ServiceException
You first upload all parts using the
uploadPart(UploadPartRequest)
method. After successfully
uploading all individual parts of an upload, you call this operation to
complete the upload. Upon receiving this request, NOS concatenates all
the parts in ascending order by part number to create a new object. In
the CompleteMultipartUpload request, you must provide the parts list. For
each part in the list, you provide the part number and the ETag header
value, returned after that part was uploaded.
Processing of a CompleteMultipartUpload request may take several minutes to complete.
request
- The CompleteMultipartUploadRequest object that specifies all
the parameters of this operation.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server pointMultipartUploadListing listMultipartUploads(ListMultipartUploadsRequest request) throws ClientException, ServiceException
This operation returns at most 1,000 multipart uploads in the response by default. The number of multipart uploads can be further limited using the MaxUploads property on the request parameter. If there are additional multipart uploads that satisfy the list criteria, the response will contain an IsTruncated property with the value set to true. To list the additional multipart uploads use the KeyMarker and UploadIdMarker properties on the request parameters.
request
- The ListMultipartUploadsRequest object that specifies all the
parameters of this operation.ClientException
- If any errors are occured in the client point.ServiceException
- If any errors occurred in NOS server point.void shutdown()
BucketLifecycleConfiguration getBucketLifecycleConfiguration(String bucketName) throws ClientException, ServiceException
bucketName
- The name of the bucket for which to retrieve lifecycle
configuration.ClientException
ServiceException
void setBucketLifecycleConfiguration(String bucketName, BucketLifecycleConfiguration bucketLifecycleConfiguration) throws ClientException, ServiceException
bucketName
- The name of the bucket for which to set the lifecycle
configuration.bucketLifecycleConfiguration
- The new lifecycle configuration for this bucket, which
completely replaces any existing configuration.ClientException
ServiceException
void setBucketLifecycleConfiguration(SetBucketLifecycleConfigurationRequest setBucketLifecycleConfigurationRequest) throws ClientException, ServiceException
setBucketLifecycleConfigurationRequest
- The request object containing all options for setting the
bucket lifecycle configuration.ClientException
ServiceException
void deleteBucketLifecycleConfiguration(String bucketName) throws ClientException, ServiceException
bucketName
- The name of the bucket for which to remove the lifecycle
configuration.ClientException
ServiceException
GetBucketStatsResult getBucketStats(String bucketName) throws ClientException, ServiceException
bucketName
- The name of the bucket for which to get the statsClientException
ServiceException
Copyright © 2017. All Rights Reserved.