public class SCSClient extends SCSWebServiceClient implements SCS
client, clientConfiguration, endpoint, endpoint4Upload, timeOffset
构造器和说明 |
---|
SCSClient()
Constructs a new client to invoke service methods on Amazon S3.
|
SCSClient(AWSCredentials awsCredentials)
Constructs a new Amazon S3 client using the specified AWS credentials to
access Amazon S3.
|
SCSClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration)
Constructs a new Amazon S3 client using the specified AWS credentials and
client configuration to access Amazon S3.
|
SCSClient(AWSCredentialsProvider credentialsProvider)
Constructs a new Amazon S3 client using the specified AWS credentials
provider to access Amazon S3.
|
SCSClient(AWSCredentialsProvider credentialsProvider,
ClientConfiguration clientConfiguration)
Constructs a new Amazon S3 client using the specified AWS credentials and
client configuration to access Amazon S3.
|
SCSClient(ClientConfiguration clientConfiguration)
Constructs a new client using the specified client configuration to
access Amazon S3.
|
限定符和类型 | 方法和说明 |
---|---|
ObjectMetadata |
completeMultipartUpload(CompleteMultipartUploadRequest completeMultipartUploadRequest)
Completes a multipart upload by assembling previously uploaded parts.
|
void |
copyObject(CopyObjectRequest copyObjectRequest)
Copies a source object to a new destination in SCS.
|
void |
copyObject(String sourceBucketName,
String sourceKey,
String destinationBucketName,
String destinationKey)
Copies a source object to a new destination in SCS.
|
Bucket |
createBucket(CreateBucketRequest createBucketRequest)
Creates a new SCS bucket in the default
Every object stored in SCS is contained within a bucket.
|
Bucket |
createBucket(String bucketName)
Creates a new SCS bucket with the specified name in the default
Every object stored in SCS is contained within a bucket.
|
protected ExecutionContext |
createExecutionContext(SCSWebServiceRequest req) |
protected <X extends SCSWebServiceRequest> |
createRequest(String bucketName,
String key,
X originalRequest,
HttpMethodName httpMethod)
Creates and initializes a new request object for the specified S3
resource.
|
protected Signer |
createSigner(Request<?> request,
String bucketName,
String key) |
void |
deleteBucket(DeleteBucketRequest deleteBucketRequest)
Deletes the specified bucket.
|
void |
deleteBucket(String bucketName)
Deletes the specified bucket.
|
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.
|
boolean |
doesBucketExist(String bucketName)
Checks if the specified bucket exists.
|
URL |
generatePresignedUrl(GeneratePresignedUrlRequest generatePresignedUrlRequest)
Returns a pre-signed URL for accessing an SCS resource.
|
URL |
generatePresignedUrl(String bucketName,
String key,
Date expiration,
boolean bucketNameAsDomain)
Returns a pre-signed URL for accessing an SCS resource.
|
URL |
generatePresignedUrl(String bucketName,
String key,
Date expiration,
HttpMethod method,
boolean bucketNameAsDomain)
Returns a pre-signed URL for accessing an SCS resource.
|
AccessControlList |
getBucketAcl(GetBucketAclRequest getBucketAclRequest)
Gets the
AccessControlList (ACL) for the specified SCS
bucket. |
AccessControlList |
getBucketAcl(String bucketName)
Gets the
AccessControlList (ACL) for the specified SCS bucket. |
BucketInfo |
getBucketInfo(String bucketName)
http://open.sinastorage.cn/?
|
S3Object |
getObject(GetObjectRequest getObjectRequest)
Gets the object stored in SCS under the specified bucket and
key.
|
ObjectMetadata |
getObject(GetObjectRequest getObjectRequest,
File destinationFile)
Gets the object metadata for the object stored
in SCS under the specified bucket and key,
and saves the object contents to the
specified file.
|
S3Object |
getObject(String bucketName,
String key)
Gets the object stored in SCS under the specified bucket and
key.
|
AccessControlList |
getObjectAcl(String bucketName,
String key)
Gets the
AccessControlList (ACL) for the specified object in SCS. |
ObjectInfo |
getObjectInfo(String bucketName,
String key)
http://open.sinastorage.cn/?
|
ObjectMetadata |
getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest)
Gets the metadata for the specified SCS object without
actually fetching the object itself.
|
ObjectMetadata |
getObjectMetadata(String bucketName,
String key)
Gets the metadata for the specified SCS object without
actually fetching the object itself.
|
String |
getResourceUrl(String bucketName,
String key)
Returns the URL to the key in the bucket given, using the client's scheme
and endpoint.
|
URL |
getUrl(String bucketName,
String key)
Returns an URL for the object stored in the specified bucket and
key.
|
InitiateMultipartUploadResult |
initiateMultipartUpload(InitiateMultipartUploadRequest initiateMultipartUploadRequest)
Initiates a multipart upload and returns an InitiateMultipartUploadResult
which contains an upload ID.
|
InitiateMultipartUploadResult |
initiateMultipartUpload(String bucketName,
String key)
Initiates a multipart upload and returns an InitiateMultipartUploadResult
|
List<Bucket> |
listBuckets()
Returns a list of all SCS buckets that the
authenticated sender of the request owns.
|
List<Bucket> |
listBuckets(ListBucketsRequest listBucketsRequest)
Returns a list of all SCS buckets that the
authenticated sender of the request owns.
|
ObjectListing |
listNextBatchOfObjects(ObjectListing previousObjectListing)
Provides an easy way to continue a truncated object listing and retrieve
the next page of results.
|
ObjectListing |
listObjects(ListObjectsRequest listObjectsRequest)
Returns a list of summary information about the objects in the specified
bucket.
|
ObjectListing |
listObjects(String bucketName)
Returns a list of summary information about the objects in the specified
buckets.
|
ObjectListing |
listObjects(String bucketName,
String prefix)
Returns a list of summary information about the objects in the specified
bucket.
|
PartListing |
listParts(ListPartsRequest listPartsRequest)
Lists the parts that have been uploaded for a specific multipart upload.
|
protected static void |
populateRequestMetadata(Request<?> request,
ObjectMetadata metadata)
Populates the specified request object with the appropriate headers from
the
ObjectMetadata object. |
protected <T> void |
presignRequest(Request<T> request,
HttpMethod methodName,
String bucketName,
String key,
Date expiration,
String subResource)
Pre-signs the specified request, using a signature query-string
parameter.
|
PutObjectResult |
putObject(PutObjectRequest putObjectRequest)
Uploads a new object to the specified SCS bucket.
|
PutObjectResult |
putObject(String bucketName,
String key,
File file)
Uploads the specified file to SCS under the specified bucket and
key name.
|
PutObjectResult |
putObject(String bucketName,
String key,
File file,
Map<String,String> requestHeader)
Uploads the specified file to SCS 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 SCS under
the specified bucket and key name.
|
PutObjectResult |
putObjectRelax(String bucketName,
String key,
String fileSha1,
long fileLength)
秒传接口
|
void |
setBucketAcl(SetBucketAclRequest setBucketAclRequest)
Sets the
AccessControlList for the specified SCS bucket. |
void |
setBucketAcl(String bucketName,
AccessControlList acl)
Sets the
AccessControlList for the specified SCS bucket. |
void |
setObjectAcl(String bucketName,
String key,
AccessControlList acl)
Sets the
AccessControlList for the specified object in SCS. |
void |
setObjectMetadata(String bucketName,
String key,
ObjectMetadata objectMetadata)
设置object metadata
|
void |
setS3ClientOptions(S3ClientOptions clientOptions)
Override the default S3 client options for this client.
|
UploadPartResult |
uploadPart(UploadPartRequest uploadPartRequest)
Uploads a part in a multipart upload.
|
convertToHttpRequest, createExecutionContext, createExecutionContext, getTimeOffset, setConfiguration, setEndpoint, setEndpoint4Upload, setTimeOffset, shutdown, withTimeOffset
public SCSClient()
If no credentials are found in the chain, this client will attempt to work in an anonymous mode where requests aren't signed. Only a subset of the Amazon S3 API will work with anonymous (i.e. unsigned) requests, but this can prove useful in some situations. For example:
Permission.Read
permission for the
GroupGrantee#AllUsers
group, anonymous clients can call
listObjects(String)
to see what objects are stored in a bucket.Permission.Read
permission for the
GroupGrantee#AllUsers
group, anonymous clients can call
getObject(String, String)
and
getObjectMetadata(String, String)
to pull object content and
metadata.Permission.Write
permission for the
GroupGrantee#AllUsers
group, anonymous clients can upload objects
to the bucket.
You can force the client to operate in an anonymous mode, and skip the credentials
provider chain, by passing in null
for the credentials.
public SCSClient(AWSCredentials awsCredentials)
awsCredentials
- The AWS credentials to use when making requests to Amazon S3
with this client.SCSClient()
,
SCSClient(AWSCredentials, ClientConfiguration)
public SCSClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
awsCredentials
- The AWS credentials to use when making requests to Amazon S3
with this client.clientConfiguration
- The client configuration options controlling how this client
connects to Amazon S3 (e.g. proxy settings, retry counts, etc).SCSClient()
,
SCSClient(AWSCredentials)
public SCSClient(AWSCredentialsProvider credentialsProvider)
credentialsProvider
- The AWS credentials provider which will provide credentials
to authenticate requests with AWS services.public SCSClient(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration)
credentialsProvider
- The AWS credentials provider which will provide credentials
to authenticate requests with AWS services.clientConfiguration
- The client configuration options controlling how this client
connects to Amazon S3 (e.g. proxy settings, retry counts, etc).public SCSClient(ClientConfiguration clientConfiguration)
If no credentials are found in the chain, this client will attempt to work in an anonymous mode where requests aren't signed. Only a subset of the Amazon S3 API will work with anonymous (i.e. unsigned) requests, but this can prove useful in some situations. For example:
Permission.Read
permission for the
GroupGrantee#AllUsers
group, anonymous clients can call
listObjects(String)
to see what objects are stored in a bucket.Permission.Read
permission for the
GroupGrantee#AllUsers
group, anonymous clients can call
getObject(String, String)
and
getObjectMetadata(String, String)
to pull object content and
metadata.Permission.Write
permission for the
GroupGrantee#AllUsers
group, anonymous clients can upload objects
to the bucket.
You can force the client to operate in an anonymous mode, and skip the
credentials provider chain, by passing in null
for the
credentials.
clientConfiguration
- The client configuration options controlling how this client
connects to Amazon S3 (e.g. proxy settings, retry counts, etc).SCSClient(AWSCredentials)
,
SCSClient(AWSCredentials, ClientConfiguration)
protected final ExecutionContext createExecutionContext(SCSWebServiceRequest req)
public void setS3ClientOptions(S3ClientOptions clientOptions)
Override the default S3 client options for this client.
setS3ClientOptions
在接口中 SCS
clientOptions
- The S3 client options to use.public ObjectListing listObjects(String bucketName) throws SCSClientException, SCSServiceException
SCS
Returns a list of summary information about the objects in the specified buckets. List results are always returned in lexicographic (alphabetical) order.
Because buckets can contain a virtually unlimited number of keys, the
complete results of a list query can be extremely large. To manage large
result sets, SCS uses pagination to split them into multiple
responses. Always check the
ObjectListing.isTruncated()
method to see if the returned
listing is complete or if additional calls are needed to get
more results. Alternatively, use the
listNextBatchOfObjects(ObjectListing)
method as
an easy way to get the next page of object listings.
The total number of keys in a bucket doesn't substantially affect list performance.
listObjects
在接口中 SCS
bucketName
- The name of the SCS bucket to list.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.listObjects(String, String)
,
listObjects(ListObjectsRequest)
public ObjectListing listObjects(String bucketName, String prefix) throws SCSClientException, SCSServiceException
SCS
Returns a list of summary information about the objects in the specified bucket. Depending on request parameters, additional information is returned, such as common prefixes if a delimiter was specified. List results are always returned in lexicographic (alphabetical) order.
Because buckets can contain a virtually unlimited number of keys, the
complete results of a list query can be extremely large. To manage large
result sets, SCS uses pagination to split them into multiple
responses. Always check the
ObjectListing.isTruncated()
method to see if the returned
listing is complete or if additional calls are needed to get
more results. Alternatively, use the
listNextBatchOfObjects(ObjectListing)
method as
an easy way to get the next page of object listings.
For example, consider a bucket that contains the following keys:
listObjects
with
a prefix
value of "foo/" and a delimiter
value of "/"
on this bucket, an ObjectListing
is returned that contains one key
("foo/boo") and one entry in the common prefixes list ("foo/bar/").
To see deeper into the virtual hierarchy, make another
call to listObjects
setting the prefix parameter to any interesting
common prefix to list the individual keys under that prefix.
The total number of keys in a bucket doesn't substantially affect list performance.
listObjects
在接口中 SCS
bucketName
- The name of the SCS 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.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.listObjects(String)
,
listObjects(ListObjectsRequest)
public ObjectListing listObjects(ListObjectsRequest listObjectsRequest) throws SCSClientException, SCSServiceException
SCS
Returns a list of summary information about the objects in the specified bucket. Depending on the request parameters, additional information is returned, such as common prefixes if a delimiter was specified. List results are always returned in lexicographic (alphabetical) order.
Because buckets can contain a virtually unlimited number of keys, the
complete results of a list query can be extremely large. To manage large
result sets, SCS uses pagination to split them into multiple
responses. Always check the
ObjectListing.isTruncated()
method to see if the returned
listing is complete or if additional calls are needed to get
more results. Alternatively, use the
listNextBatchOfObjects(ObjectListing)
method as
an easy way to get the next page of object listings.
Calling ListObjectsRequest.setDelimiter(String)
sets the delimiter, allowing groups of keys that share the
delimiter-terminated prefix to be included
in the returned listing. This allows applications to organize and browse
their keys hierarchically, similar to how a file system organizes files
into directories. These common prefixes can be retrieved
through the ObjectListing.getCommonPrefixes()
method.
For example, consider a bucket that contains the following keys:
listObjects
with
a prefix value of "foo/" and a delimiter value of "/"
on this bucket, an ObjectListing
is returned that contains one key
("foo/boo") and one entry in the common prefixes list ("foo/bar/").
To see deeper into the virtual hierarchy, make another
call to listObjects
setting the prefix parameter to any interesting
common prefix to list the individual keys under that prefix.
The total number of keys in a bucket doesn't substantially affect list performance.
listObjects
在接口中 SCS
listObjectsRequest
- The request object containing all options for listing the
objects in a specified bucket.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.listObjects(String)
,
listObjects(String, String)
public ObjectListing listNextBatchOfObjects(ObjectListing previousObjectListing) throws SCSClientException, SCSServiceException
SCS
Provides an easy way to continue a truncated object listing and retrieve the next page of results.
To continue the object listing and retrieve the next page of results,
call the initial ObjectListing
from one of the
listObjects
methods.
If truncated
(indicated when ObjectListing.isTruncated()
returns true
),
pass the ObjectListing
back into this method
in order to retrieve the
next page of results. Continue using this method to
retrieve more results until the returned ObjectListing
indicates that
it is not truncated.
listNextBatchOfObjects
在接口中 SCS
previousObjectListing
- The previous truncated ObjectListing
.
If a
non-truncated ObjectListing
is passed in, an empty
ObjectListing
is returned without ever contacting
SCS.ObjectListing
results, beginning immediately
after the last result in the specified previous ObjectListing
.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.listObjects(String)
,
listObjects(String, String)
,
listObjects(ListObjectsRequest)
public List<Bucket> listBuckets(ListBucketsRequest listBucketsRequest) throws SCSClientException, SCSServiceException
SCS
Returns a list of all SCS buckets that the authenticated sender of the request owns.
Users must authenticate with a valid AWS Access Key ID that is registered with SCS. Anonymous requests cannot list buckets, and users cannot list buckets that they did not create.
listBuckets
在接口中 SCS
SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.listBuckets()
public List<Bucket> listBuckets() throws SCSClientException, SCSServiceException
SCS
Returns a list of all SCS buckets that the authenticated sender of the request owns.
Users must authenticate with a valid AWS Access Key ID that is registered with SCS. Anonymous requests cannot list buckets, and users cannot list buckets that they did not create.
listBuckets
在接口中 SCS
SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.listBuckets(ListBucketsRequest)
public Bucket createBucket(String bucketName) throws SCSClientException, SCSServiceException
SCS
Creates a new SCS bucket with the specified name in the default
Every object stored in SCS is contained within a bucket. Buckets partition the namespace of objects stored in SCS at the top level. Within a bucket, any name can be used for objects. However, bucket names must be unique across all of SCS.
Bucket ownership is similar to the ownership of Internet domain names. Within SCS, only a single user owns each bucket. Once a uniquely named bucket is created in SCS, organize and name the objects within the bucket in any way. Ownership of the bucket is retained as long as the owner has an SCS account.
To conform with DNS requirements, the following constraints apply:
There are no limits to the number of objects that can be stored in a bucket. Performance does not vary based on the number of buckets used. Store all objects within a single bucket or organize them across several buckets.
Buckets cannot be nested; buckets cannot be created within other buckets.
Do not make bucket create or delete calls in the high availability code path of an application. Create or delete buckets in a separate initialization or setup routine that runs less often.
To create a bucket, authenticate with an account that has a valid AWS Access Key ID and is registered with SCS. Anonymous requests are never allowed to create buckets.
createBucket
在接口中 SCS
bucketName
- The name of the bucket to create.
All buckets in SCS share a single namespace;
ensure the bucket is given a unique name.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public Bucket createBucket(CreateBucketRequest createBucketRequest) throws SCSClientException, SCSServiceException
SCS
Creates a new SCS bucket in the default
Every object stored in SCS is contained within a bucket. Buckets partition the namespace of objects stored in SCS at the top level. Within a bucket, any name can be used for objects. However, bucket names must be unique across all of SCS.
Bucket ownership is similar to the ownership of Internet domain names. Within SCS, only a single user owns each bucket. Once a uniquely named bucket is created in SCS, organize and name the objects within the bucket in any way. Ownership of the bucket is retained as long as the owner has an SCS account.
To conform with DNS requirements, the following constraints apply:
There are no limits to the number of objects that can be stored in a bucket. Performance does not vary based on the number of buckets used. Store all objects within a single bucket or organize them across several buckets.
Buckets cannot be nested; buckets cannot be created within other buckets.
Do not make bucket create or delete calls in the high availability code path of an application. Create or delete buckets in a separate initialization or setup routine that runs less often.
To create a bucket, authenticate with an account that has a valid AWS Access Key ID and is registered with SCS. Anonymous requests are never allowed to create buckets.
createBucket
在接口中 SCS
createBucketRequest
- The request object containing all options for creating an SCS
bucket.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public AccessControlList getObjectAcl(String bucketName, String key) throws SCSClientException, SCSServiceException
SCS
Gets the AccessControlList
(ACL) for the specified object in SCS.
Each bucket and object in SCS has an ACL that defines its access control policy. When a request is made, SCS 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, SCS returns an error.
getObjectAcl
在接口中 SCS
bucketName
- The name of the bucket containing the object whose ACL is
being retrieved.key
- The key of the object within the specified bucket whose ACL is
being retrieved.AccessControlList
for the specified SCS object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS#getObjectAcl(String, String, String)
public void setObjectAcl(String bucketName, String key, AccessControlList acl) throws SCSClientException, SCSServiceException
SCS
Sets the AccessControlList
for the specified object in SCS.
Each bucket and object in SCS has an ACL that defines its access control policy. When a request is made, SCS 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, SCS returns an error.
When constructing a custom AccessControlList
,
callers typically retrieve
the existing AccessControlList
for an object (
getObjectAcl(String, String)
), modify it as
necessary, and then use this method to upload the new ACL.
setObjectAcl
在接口中 SCS
bucketName
- The name of the bucket containing the object whose ACL is
being set.key
- The key of the object within the specified bucket whose ACL is
being set.acl
- The new AccessControlList
for the specified object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS#setObjectAcl(String, String, CannedAccessControlList)
,
SCS#setObjectAcl(String, String, String, AccessControlList)
,
SCS#setObjectAcl(String, String, String, CannedAccessControlList)
public BucketInfo getBucketInfo(String bucketName) throws SCSClientException, SCSServiceException
SCS
getBucketInfo
在接口中 SCS
SCSClientException
SCSServiceException
public ObjectInfo getObjectInfo(String bucketName, String key) throws SCSClientException, SCSServiceException
SCS
getObjectInfo
在接口中 SCS
SCSClientException
SCSServiceException
public AccessControlList getBucketAcl(String bucketName) throws SCSClientException, SCSServiceException
SCS
Gets the AccessControlList
(ACL) for the specified SCS bucket.
Each bucket and object in SCS has an ACL that defines its access control policy. When a request is made, SCS 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, SCS returns an error.
getBucketAcl
在接口中 SCS
bucketName
- The name of the bucket whose ACL is being retrieved.AccessControlList
for the specified S3 bucket.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public AccessControlList getBucketAcl(GetBucketAclRequest getBucketAclRequest) throws SCSClientException, SCSServiceException
SCS
AccessControlList
(ACL) for the specified SCS
bucket.
Each bucket and object in SCS has an ACL that defines its access control policy. When a request is made, SCS 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, SCS returns an error.
getBucketAcl
在接口中 SCS
getBucketAclRequest
- The request containing the name of the bucket whose ACL is
being retrieved.AccessControlList
for the specified S3 bucket.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public void setBucketAcl(String bucketName, AccessControlList acl) throws SCSClientException, SCSServiceException
SCS
Sets the AccessControlList
for the specified SCS bucket.
Each bucket and object in SCS has an ACL that defines its access control policy. When a request is made, SCS 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, SCS returns an error.
When constructing a custom AccessControlList
, callers typically retrieve
the existing AccessControlList
for a bucket (
getBucketAcl(String)
), modify it as necessary, and
then use this method to upload the new ACL.
setBucketAcl
在接口中 SCS
bucketName
- The name of the bucket whose ACL is being set.acl
- The new AccessControlList for the specified bucket.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS#setBucketAcl(String, CannedAccessControlList)
public void setBucketAcl(SetBucketAclRequest setBucketAclRequest) throws SCSClientException, SCSServiceException
SCS
AccessControlList
for the specified SCS bucket.
Each bucket and object in SCS has an ACL that defines its access control policy. When a request is made, SCS 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, SCS returns an error.
When constructing a custom AccessControlList
, callers
typically retrieve the existing AccessControlList
for a
bucket ( getBucketAcl(String)
), modify it as
necessary, and then use this method to upload the new ACL.
setBucketAcl
在接口中 SCS
setBucketAclRequest
- The request object containing the bucket to modify and the ACL
to set.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public ObjectMetadata getObjectMetadata(String bucketName, String key) throws SCSClientException, SCSServiceException
SCS
Gets the metadata for the specified SCS 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 SCS.
getObjectMetadata
在接口中 SCS
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.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.getObjectMetadata(GetObjectMetadataRequest)
public void setObjectMetadata(String bucketName, String key, ObjectMetadata objectMetadata) throws SCSClientException, SCSServiceException
SCS
setObjectMetadata
在接口中 SCS
SCSClientException
SCSServiceException
public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) throws SCSClientException, SCSServiceException
SCS
Gets the metadata for the specified SCS 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 SCS.
For more information about enabling versioning for a bucket, see
#setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest)
.
getObjectMetadata
在接口中 SCS
getObjectMetadataRequest
- The request object specifying the bucket, key and optional
version ID of the object whose metadata is being retrieved.SCSClientException
- If any errors are encountered on the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.getObjectMetadata(String, String)
public S3Object getObject(String bucketName, String key) throws SCSClientException, SCSServiceException
SCS
Gets the object stored in SCS under the specified bucket and key.
Be extremely careful when using this method; the returned SCS 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:
To get an object from SCS, the caller must have Permission.Read
access to the object.
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 SCS.getObject(GetObjectRequest)
.
getObject
在接口中 SCS
bucketName
- The name of the bucket containing the desired object.key
- The key under which the desired object is stored.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.getObject(GetObjectRequest)
,
SCS.getObject(GetObjectRequest, File)
public boolean doesBucketExist(String bucketName) throws SCSClientException, SCSServiceException
SCS
doesBucketExist
在接口中 SCS
bucketName
- The name of the bucket to check.true
if the specified bucket exists in
SCS; the value
false
if there is no bucket in SCS with that name.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.createBucket(CreateBucketRequest)
public S3Object getObject(GetObjectRequest getObjectRequest) throws SCSClientException, SCSServiceException
SCS
Gets the object stored in SCS 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 SCS 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.
To get an object from SCS, the caller must have Permission.Read
access to the object.
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 SCS receives the request.
If the advanced options provided in GetObjectRequest
aren't needed,
use the simpler SCS.getObject(String bucketName, String key)
method.
getObject
在接口中 SCS
getObjectRequest
- The request object containing all the options on how to
download the object.null
if constraints were specified but not met.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.getObject(String, String)
,
SCS.getObject(GetObjectRequest, File)
public ObjectMetadata getObject(GetObjectRequest getObjectRequest, File destinationFile) throws SCSClientException, SCSServiceException
SCS
Gets the object metadata for the object stored
in SCS 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 SCS.getObject(GetObjectRequest)
,
use this method to ensure that the underlying
HTTP stream resources are automatically closed as soon as possible.
The SCS clients handles immediate storage of the object
contents to the specified file.
To get an object from SCS, the caller must have Permission.Read
access to the object.
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 SCS receives the request.
getObject
在接口中 SCS
getObjectRequest
- The request object containing all the options on how to
download the SCS object content.destinationFile
- Indicates the file (which might already exist) where
to save the object content being downloading from SCS.null
if constraints were specified but not met.SCSClientException
- If any errors are encountered in the client while making the
request, handling the response, or writing the incoming data
from S3 to the specified destination file.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.getObject(String, String)
,
SCS.getObject(GetObjectRequest)
public void deleteBucket(String bucketName) throws SCSClientException, SCSServiceException
SCS
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.
deleteBucket
在接口中 SCS
bucketName
- The name of the bucket to delete.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.deleteBucket(String)
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws SCSClientException, SCSServiceException
SCS
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).
deleteBucket
在接口中 SCS
deleteBucketRequest
- The request object containing all options for deleting an SCS
bucket.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.deleteBucket(String)
public PutObjectResult putObject(String bucketName, String key, File file) throws SCSClientException, SCSServiceException
SCS
Uploads the specified file to SCS under the specified bucket and key name.
SCS 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. SCS uses checksums to validate the data in each file.
Using the file extension, SCS 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
SCS#deleteVersion(String, String, String)
.
If versioning is not enabled, this operation will overwrite an existing object with the same key; SCS will store the last write request. SCS does not provide object locking. If SCS 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.
The specified bucket must already exist and the caller must have
Permission.Write
permission to the bucket to upload an object.
putObject
在接口中 SCS
bucketName
- The name of an existing bucket, to which you have
Permission.Write
permission.key
- The key under which to store the specified file.file
- The file containing the data to be uploaded to SCS.PutObjectResult
object containing the information
returned by SCS for the newly created object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.putObject(PutObjectRequest)
,
SCS.putObject(String, String, InputStream, ObjectMetadata)
public PutObjectResult putObject(String bucketName, String key, File file, Map<String,String> requestHeader) throws SCSClientException, SCSServiceException
SCS
putObject
在接口中 SCS
requestHeader
- custom request headerSCSClientException
SCSServiceException
public PutObjectResult putObjectRelax(String bucketName, String key, String fileSha1, long fileLength)
SCS
putObjectRelax
在接口中 SCS
fileSha1
- 文件sha1值fileLength
- 文件大小public PutObjectResult putObject(String bucketName, String key, InputStream input, ObjectMetadata metadata) throws SCSClientException, SCSServiceException
SCS
Uploads the specified input stream and object metadata to SCS under the specified bucket and key name.
SCS 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 SCS, ensuring the data has not corrupted in transit over the network.
Using the file extension, SCS 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 SCS. 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 SCS 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
SCS#deleteVersion(String, String, String)
.
If versioning is not enabled, this operation will overwrite an existing object with the same key; SCS will store the last write request. SCS does not provide object locking. If SCS 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.
The specified bucket must already exist and the caller must have
Permission.Write
permission to the bucket to upload an object.
putObject
在接口中 SCS
bucketName
- The name of an existing bucket, to which you have
Permission.Write
permission.key
- The key under which to store the specified file.input
- The input stream containing the data to be uploaded to Amazon
S3.metadata
- Additional metadata instructing SCS how to handle the
uploaded data (e.g. custom user metadata, hooks for specifying
content type, etc.).PutObjectResult
object containing the information
returned by SCS for the newly created object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.putObject(String, String, File)
,
SCS.putObject(PutObjectRequest)
public PutObjectResult putObject(PutObjectRequest putObjectRequest) throws SCSClientException, SCSServiceException
SCS
Uploads a new object to the specified SCS 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.
SCS 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
SCS#deleteVersion(String, String, String)
.
If versioning is not enabled, this operation will overwrite an existing object with the same key; SCS will store the last write request. SCS does not provide object locking. If SCS 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.
The specified bucket must already exist and the caller must have
Permission.Write
permission to the bucket to upload an object.
putObject
在接口中 SCS
putObjectRequest
- The request object containing all the parameters to upload a
new object to SCS.PutObjectResult
object containing the information
returned by SCS for the newly created object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.SCS.putObject(String, String, File)
,
SCS.putObject(String, String, InputStream, ObjectMetadata)
public void copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) throws SCSClientException, SCSServiceException
SCS
Copies a source object to a new destination in SCS.
By default, all object metadata for the source object are copied to
the new destination object. The SCS AcccessControlList
(ACL)
is not copied to the new
object; the new object will have the default SCS 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 SCS
object. Additional options are available by calling the
copyObject(CopyObjectRequest)
method, including
conditional constraints for copying objects, setting ACLs, overwriting
object metadata, etc.
copyObject
在接口中 SCS
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.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.copyObject(CopyObjectRequest)
public void copyObject(CopyObjectRequest copyObjectRequest) throws SCSClientException, SCSServiceException
SCS
Copies a source object to a new destination in SCS.
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 SCS Acccess Control List (ACL)
is not copied to the new object. The new object will have
the default SCS 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.
If constraints are specified in the CopyObjectRequest
(e.g.
CopyObjectRequest.setMatchingETagConstraints(List)
)
and are not satisfied when SCS receives the
request, this method returns null
.
This method returns a non-null result under all other
circumstances.
This method exposes all the advanced options for copying an SCS
object. For simple needs, use the
copyObject(String, String, String, String)
method.
copyObject
在接口中 SCS
copyObjectRequest
- The request object containing all the options for copying an
SCS object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.copyObject(String, String, String, String)
public void deleteObject(String bucketName, String key) throws SCSClientException, SCSServiceException
SCS
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, SCS returns a success message instead of an error message.
deleteObject
在接口中 SCS
bucketName
- The name of the SCS bucket containing the object to
delete.key
- The key of the object to delete.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.deleteObject(DeleteObjectRequest)
public void deleteObject(DeleteObjectRequest deleteObjectRequest) throws SCSClientException, SCSServiceException
SCS
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, SCS will return a success message instead of an error message.
deleteObject
在接口中 SCS
deleteObjectRequest
- The request object containing all options for deleting an SCS
object.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.deleteObject(String, String)
public URL generatePresignedUrl(String bucketName, String key, Date expiration, boolean bucketNameAsDomain) throws SCSClientException
SCS
Returns a pre-signed URL for accessing an SCS resource.
Pre-signed URLs allow clients to form a URL for an SCS resource, and then sign it with the current AWS security credentials. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's AWS security credentials.
Pre-signed URLs are useful in many situations where AWS security credentials aren't available from the client that needs to make the actual request to SCS.
For example, an application may need remote users to upload files to the application owner's SCS bucket, but doesn't need to ship the AWS 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 AWS security credentials, then the pre-signed URL can be passed to the end user's application to use.
generatePresignedUrl
在接口中 SCS
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.SCSClientException
- If there were any problems pre-signing the request for the
specified S3 object.SCS#generatePresignedUrl(String, String, Date, HttpMethod)
,
SCS.generatePresignedUrl(GeneratePresignedUrlRequest)
public URL generatePresignedUrl(String bucketName, String key, Date expiration, HttpMethod method, boolean bucketNameAsDomain) throws SCSClientException
SCS
Returns a pre-signed URL for accessing an SCS resource.
Pre-signed URLs allow clients to form a URL for an SCS resource, and then sign it with the current AWS security credentials. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's AWS security credentials.
Pre-signed URLs are useful in many situations where AWS security credentials aren't available from the client that needs to make the actual request to SCS.
For example, an application may need remote users to upload files to the application owner's SCS bucket, but doesn't need to ship the AWS 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 AWS security credentials, then the pre-signed URL can be passed to the end user's application to use.
generatePresignedUrl
在接口中 SCS
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 URLSCSClientException
- If there were any problems pre-signing the request for the
specified S3 object.SCS#generatePresignedUrl(String, String, Date)
,
SCS.generatePresignedUrl(GeneratePresignedUrlRequest)
public URL generatePresignedUrl(GeneratePresignedUrlRequest generatePresignedUrlRequest) throws SCSClientException
SCS
Returns a pre-signed URL for accessing an SCS resource.
Pre-signed URLs allow clients to form a URL for an SCS resource, and then sign it with the current AWS security credentials. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's AWS security credentials.
Pre-signed URLs are useful in many situations where AWS security credentials aren't available from the client that needs to make the actual request to SCS.
For example, an application may need remote users to upload files to the application owner's SCS bucket, but doesn't need to ship the AWS 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 AWS 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.
generatePresignedUrl
在接口中 SCS
generatePresignedUrlRequest
- The request object containing all the options for generating a
pre-signed URL (bucket name, key, expiration date, etc).SCSClientException
- If there were any problems pre-signing the request for the
SCS resource.SCS#generatePresignedUrl(String, String, Date)
,
SCS#generatePresignedUrl(String, String, Date, HttpMethod)
public ObjectMetadata completeMultipartUpload(CompleteMultipartUploadRequest completeMultipartUploadRequest) throws SCSClientException, SCSServiceException
SCS
You first upload all parts using the
SCS.uploadPart(UploadPartRequest)
method. After successfully
uploading all individual parts of an upload, you call this operation to
complete the upload. Upon receiving this request, SCS 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.
completeMultipartUpload
在接口中 SCS
completeMultipartUploadRequest
- The CompleteMultipartUploadRequest object that specifies all
the parameters of this operation.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public InitiateMultipartUploadResult initiateMultipartUpload(String bucketName, String key) throws SCSClientException, SCSServiceException
SCS
public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest initiateMultipartUploadRequest) throws SCSClientException, SCSServiceException
SCS
SCS.uploadPart(UploadPartRequest)
requests. You also include this
upload ID in the final request to either complete, or abort the multipart
upload request.initiateMultipartUpload
在接口中 SCS
initiateMultipartUploadRequest
- The InitiateMultipartUploadRequest object that specifies all
the parameters of this operation.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public PartListing listParts(ListPartsRequest listPartsRequest) throws SCSClientException, SCSServiceException
SCS
This method must include the upload ID, returned by the
SCS.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.
listParts
在接口中 SCS
listPartsRequest
- The ListPartsRequest object that specifies all the parameters
of this operation.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.public UploadPartResult uploadPart(UploadPartRequest uploadPartRequest) throws SCSClientException, SCSServiceException
SCS
Your UploadPart request must include an upload ID and a part number. The upload ID is the ID returned by SCS 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. SCS checks the part data against the provided MD5 value. If they do not match, SCS 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 SCS 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.
uploadPart
在接口中 SCS
uploadPartRequest
- The UploadPartRequest object that specifies all the parameters
of this operation.SCSClientException
- If any errors are encountered in the client while making the
request or handling the response.SCSServiceException
- If any errors occurred in SCS while processing the
request.protected <T> void presignRequest(Request<T> request, HttpMethod methodName, String bucketName, String key, Date expiration, String subResource)
request
- The request to sign.methodName
- The HTTP method (GET, PUT, DELETE, HEAD) for the specified
request.bucketName
- The name of the bucket involved in the request. If the request
is not an operation on a bucket this parameter should be null.key
- The object key involved in the request. If the request is not
an operation on an object, this parameter should be null.expiration
- The time at which the signed request is no longer valid, and
will stop working.subResource
- The optional sub-resource being requested as part of the
request (e.g. "location", "acl", "logging", or "torrent").protected static void populateRequestMetadata(Request<?> request, ObjectMetadata metadata)
Populates the specified request object with the appropriate headers from
the ObjectMetadata
object.
request
- The request to populate with headers.metadata
- The metadata containing the header information to include in
the request.public String getResourceUrl(String bucketName, String key)
public URL getUrl(String bucketName, String key)
If the object identified by the given bucket and key has public read
permissions (ex: CannedAccessControlList.PublicRead
), then this
URL can be directly accessed to retrieve the object's data.
bucketName
- The name of the bucket containing the object whose URL is
being requested.key
- The key under which the object whose URL is being requested is
stored.protected <X extends SCSWebServiceRequest> Request<X> createRequest(String bucketName, String key, X originalRequest, HttpMethodName httpMethod)
bucketName
- An optional parameter indicating the name of the bucket
containing the resource involved in the request.key
- An optional parameter indicating the key under which the
desired resource is stored in the specified bucket.originalRequest
- The original request, as created by the user.httpMethod
- The HTTP method to use when sending the request.Copyright © 2016. All rights reserved.