Applicable Products
myQNAPcloud Object
What is myQNAPcloud Object?
myQNAPcloud Object is a cloud-based object storage service designed to provide high-performance, reliable, and secure data storage for a broad range of applications and use cases. This service is built to be fully compatible with the Amazon Web Service Simple Storage Service (AWS S3) API, ensuring seamless integration with S3-compatible applications and gateway devices.
myQNAPcloud Object is tailored for individuals and organizations seeking a cost-effective and efficient data storage infrastructure. Designed to work with S3-compatible applications, myQNAPcloud Object enables users to leverage familiar tools and workflows while benefiting from the reliability and flexibility of QNAP’s ecosystem.
- Compatibility: myQNAPcloud Object is designed to be fully compatible with the AWS S3 API, ensuring that existing AWS S3-compatible applications can work seamlessly.
- Performance: myQNAPcloud Object offers a high-performance storage solution optimized for reliability and efficiency.
About myQNAPcloud Object S3 API Guide
While myQNAPcloud Object aligns closely with AWS S3, certain features may have been enhanced or implemented differently. This guide aims to clarify these nuances to help users maximize the potential of myQNAPcloud Object.
This guide uses examples involving access to buckets in specific myQNAPcloud Object regions. For more information about region-specific endpoints and service URLs, see "Service URLs for myQNAPcloud Object Storage Regions".
Note
- Regional URLs: When accessing buckets, ensure that you use URLs specific to the myQNAPcloud Object storage region where your bucket is created. Using the incorrect URL may allow GET requests but could result in errors for PUT or DELETE operations. Refer to the [Service URLs for myQNAPcloud Object Storage Regions].
- ASW IAM: Unlike AWS, myQNAPcloud Object does not include support for AWS IAM (Identity and Access Management). Therefore, this guide focuses exclusively on S3 API compatibility and does not reference IAM-related capabilities.
REST API Introduction
Host Designation
myQNAPcloud Object supports both path-style and virtual-style requests, similar to AWS S3. A unique host name is required (for example, s3.us-east-1.myqnapcloud.io versus s3.amazonaws.com). We recommend using path-style requests, as shown in all examples in this guide (e.g., http://s3.us-east-1.myqnapcloud.io/my-bucket/my-object) because path-style requests provide greater flexibility in bucket naming, avoiding domain name conflicts.
Always Consistent
Unlike the strong consistency model of AWS S3, myQNAPcloud Object provides an "always consistent" view of all operations. This ensures that any operation following another will produce consistent results. For instance, after deleting an object (DELETE operation), performing a subsequent HEAD request will always confirm the object's deletion, eliminating the need for additional programming to wait for operation completion.
Authenticating Requests
myQNAPcloud Object supports both autonomous and signature versions 2 and 4, compatible with AWS S3, for headers and query parameters. While signature version 4 offers better security, it requires more computational resources due to the overhead of calculating the SHA256 hash. If performance is critical, signature version 2 may be used, with MD5 (returned as the ETag header) ensuring data integrity.
For version 4 signing requests, all regions are supported for myQNAPcloud Object signing requests.
myQNAPcloud Object does not support signature signing for browser-based uploads or HTML form requests, as these operations are not currently supported.
For version 2 signing, the following sub-resource keys are specified as query parameters in requests:
- append
- compose
- force_delete=true
These query parameters must be included when calculating the signature for PutObject and DeleteBucket operations.
Error Responses
Wherever possible, myQNAPcloud Object uses error responses compatible with AWS S3. Additional error codes may also be provided for enhanced functionality.
HTTP Error Codes
| Error Code | myQNAPcloud Object Description | HTTP Status Code |
|---|
| Unavailable | Temporarily unavailable | 503 |
| Unrecoverable | Data Unrecoverable |
|
| Not Implemented | Not Implemented | 501 |
| DB Entity Not found | No such entity | 404 |
| DB Entity Found | Entity Already Exists | 409 |
| Disconnect Error | Connection Closed | 410 |
| Status Internal Server Error | Internal Error: We encountered an internal error. Please contact customer support. | 500 |
| Status Forbidden | Access Denied | 403 |
| Access Forbidden |
| Account Not Activated |
| Account Problem |
| Authentication Lockout: There have been too many attempts to access the account with the wrong credentials. Please try again in five minutes. |
| Invalid Access Key ID: The AWS Access Key ID you provided does not exist in our records. |
| Invalid Authentication Code: Authentication code for device is not valid. |
| Request Time Too Skewed: The difference between the request time and the current time is too large. |
| Invalid Object State: The operation is not valid for the current state of the object. |
| Status Bad Request | Authorization Header Malformed | 400 |
| Authorization Query Parameters Error |
| Bad Digest: The Content-MD5 you specified did not match what we received. |
| Bad Request: An error occurred when parsing the HTTP request. |
| Incomplete Signature: Request must contain a signature that conforms to AWS standards. |
| Invalid Action |
| Invalid Argument |
| Invalid Digest: The Content-MD5 you specified was invalid. |
| Invalid Input |
| Invalid Parameter Value: An invalid or out-of-range value was supplied for the input parameter. |
| Invalid Request |
| Malformed Policy |
| Malformed Policy Document |
| Password Policy Violation |
| Validation Error |
| X Amz Content SHA256 Mismatch: The provided 'x-amz-content-sha256' header does not match what was computed. |
| Encryption Not Allowed: User provided encryption keys are not allowed in this operation. |
| The object was stored using a form of Server Side Encryption. The correct parameters must be provided to retrieve the object. |
| Entity Too Large: Your proposed upload is larger than the maximum allowed size. |
| Entity Too Small: Your proposed upload is smaller than the minimum allowed size. |
| Illegal Compliance Request |
| Illegal Versioning Configuration Exception: The versioning configuration specified in the request is not valid. |
| Incomplete Body: You did not provide the number of bytes specified by the Content-Length HTTP header. |
| Invalid ACL Request: You must provide only one of either ACL headers or an XML body when setting ACLs. |
| Invalid Argument |
| Invalid Bucket Name: The specified bucket is not valid. |
| Invalid Encryption Algorithm Error: The Encryption request you specified is not valid. Supported value: AES256. |
| Invalid Part Order: The list of parts was not in ascending order. Parts must be ordered by part number. |
| Invalid Part: One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag. |
| Invalid Policy Document: The content of the form does not meet the conditions specified in the policy document. |
| Key Too Long Error: Your key is too long. |
| Logging Bucket Same Owner: The logging target bucket must have the same owner as the bucket being logged. |
| Malformed XML: The XML you provided was not well formed or did not validate against our published schema. |
| Meta data Too Large: Your metadata headers exceed the maximum allowed metadata size. |
| Request Timeout: Your socket connection to the server was not read from or written to within the timeout period. |
| Too Many Buckets: You have attempted to create more buckets than allowed. |
| Too Many Components: A composite object may not have more than 1024 components. |
| Unresolvable Grant By Email Address: The email address you provided does not match any account on record. |
| Storage Quota Exceeded: Your account has surpassed its storage limit. |
| Bucket Account Inactive: The account that owns this bucket is not active. |
| Status Gone | Connection Closed: Network connection was closed. | 410 |
| Status Unprocessable Entity | Data Unrecoverable: The data in the request is unrecoverable. Please contact customer support. | 422 |
| Status Conflict | Delete Conflict | 409 |
| Entity Already Exists |
| Entity Temporarily Unmodifiable: The entity is temporarily unmodifiable. Please try again later. |
| Limit Exceeded |
| Operation Aborted: A conflicting conditional operation is currently in progress against this resource. Please try again. |
| Bucket Already Exists |
| Bucket Not Empty |
| Compliance Settings Locked: The compliance settings are now locked and cannot be changed. |
| Status Not Found | No Such Entity | 404 |
| No Such Lifecycle Configuration: The lifecycle configuration does not exist. |
| No Such Bucket: The specified bucket does not exist. |
| No Such Bucket Policy: The bucket policy does not exist. |
| No Such Key: The specified key does not exist. |
| No Such Replication Configuration: The replication configuration does not exist. |
| No Such Tag Set Error: There is no tag set associated with the bucket. |
| No Such Upload: The specified upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed. |
| No Such Version: The specified version does not exist. |
| Status Not Implemented | Not Implemented: A header you provided implies functionality that is not implemented. | 501 |
| Status Service Unavailable | Temporarily Unavailable: Resources for this operation are temporarily unavailable. Please try again later. | 503 |
| Status Found | Key Already Exists | 302 |
| Status Method Not Allowed | Method Not Allowed: This method is not allowed for other than the account owner. | 405 |
| Method Not Allowed: The specified method is not allowed against this resource. |
| Status Length Required | Missing Content Length: You must provide the Content-Length HTTP header. | 411 |
TCP Error Codes
myQNAPcloud Object supports the following TCP error codes:
- Unexpected EOF
- Broken Pipe
- Connection reset by Peer
Not Supported in myQNAPcloud Object
| Operation | Description |
|---|
| SOAP | AWS S3 has deprecated support for SOAP, and myQNAPcloud Object does not support any SOAP operations. |
Operations on Buckets with myQNAPcloud Object S3 API
Operations on buckets include: deleting, renaming, and logging buckets as well as cross-origin resource sharing (CORS) support, lifecycle policy, object locking, and compliance.
Force Delete Bucket
AWS S3 will not allow you to delete a bucket if it contains objects that have not been deleted.
myQNAPcloud Object provides a force delete option that first deletes all the objects in the bucket and then deletes the bucket. The deletion of objects is subject to policy and compliance requirements on the bucket.
To use the force delte option, simply add it as a query string. For example:
DELETE http://s3.us-east-1.myqnapcloud.io/my-bucket?force_delete=true HTTP/1.1
Renaming a Bucket
AWS S3 does not support renaming of buckets. It only supports renaming of objects in a bucket.
myQNAPcloud Object supports the renaming of buckets. The new bucket name must not be in use for the renaming to be successful. The caller must have the s3:CreateBucket policy permission to rename a bucket.
To rename a bucket, use the HTTP method MOVE along with the header field “Destination” to give the new bucket name. For example:
MOVE http://s3.us-east-1.myqnapcloud.io/my_old_bucket HTTP/1.1
Destination: my_new_bucket
MFA (Multi-Factor Authentication) Delete
myQNAPcloud Object supports the “x-amz-mfa” header while:
- configuring versioning on a bucket, or
- deleting objects with object deletion requests compatible with AWS S3.
myQNAPcloud Object does not require the “x-amz-mfa” header if the user's access credentials signing the request were authenticated with MFA. myQNAPcloud Object only supports virtual MFA devices.
Maximum Number of Buckets
Standard AWS S3 supports only 100 buckets.
myQNAPcloud Object allows for a maximum of 1000 buckets per account and this number may be increased by contacting myQNAPcloud Object Customer Support.
Bucket Logging
myQNAPcloud Object supports bucket logging, which creates a text log file of all access to a bucket. The format of the log file is identical to the AWS S3 log file.
myQNAPcloud Object bucket logging does not require any ACL permission settings to store logs in a target bucket. Although you can give permission settings in the logging request or in an ACL, they are not required for logging to work in myQNAPcloud Object. However, the bucket that is a target for log files must be inside the same account as the bucket being logged.
Bucket Cross-Origin Resource Sharing (CORS) Support
For compatibility with browser access to myQNAPcloud Object as a web server, the myQNAPcloud Object server will return CORS headers when the header “Origin” is given in an HTTP request. Additionally, the server supports the HTTP method OPTIONS on either buckets or objects to return the CORS headers needed for a browser pre-flight test before accessing myQNAPcloud Object.
Different from AWS, myQNAPcloud Object returns the settings that will allow the browser full access to myQNAPcloud Object. Hence, myQNAPcloud Object does not support the AWS functions that allow a PUT and GET on a bucket with the “cors” parameter in the URL. Note that allowing browser full access to data does not affect the security of access to any objects and all access policies will still be enforced.
The following are the HTTP headers returned by default when the header “Origin” is given in an HTTP request:
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, MOVE, OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Access-Control-Max-Age: 86400
Lifecycle Policy
The Lifecyle feature establishes a Lifecycle policy with rules to define actions that you want myQNAPcloud Object to take during the life of an object. This feature replaces the need to manually delete an object after a retention period.
Configuring Lifecycle Settings
The lifecycle settings for a bucket are configuring with the "put-bucket-lifecycle-configuration" command. For example:
$ aws s3api put-bucket-lifecycle-configuration --bucket 1-1-1-1 --endpoint-url https://s3.us-east-1.myqnapcloud.io --lifecycle-configuration file://lifecycle.json
{
"Rules": [
{
"Expiration": {
"Days": 1
},
"ID": "lifecycle_rule_1",
"Filter": {
"And": {
"ObjectSizeGreaterThan": 1,
"ObjectSizeLessThan": 21474836480
}
},
"Status": "Enabled"
},
{
"Expiration": {
"Days": 1
},
"ID": "object_lifecycle_rule_bucket_6807766",
"Filter": {
"Prefix": "1"
},
"Status": "Enabled"
}
]
}
Here is another example:
PUT https://s3.us-east-1.myqnapcloud.io/1-1-1-1?lifecycle
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<Expiration>
<Days>1</Days>
</Expiration>
<ID>lifecycle_rule_1</ID>
<Filter>
<And>
<ObjectSizeGreaterThan>1</ObjectSizeGreaterThan>
<ObjectSizeLessThan>21474836480</ObjectSizeLessThan>
</And>
</Filter>
<Status>Enabled</Status>
</Rule>
<Rule>
<Expiration>
<Days>1</Days>
</Expiration>
<ID>object_lifecycle_rule_bucket_6807766</ID>
<Filter>
<Prefix>1</Prefix>
</Filter>
<Status>Enabled</Status>
</Rule>
</LifecycleConfiguration>
There is no response body for this call.
Retrieving Lifecycle Settings
The lifecycle settings for a bucket can be retrieved with the "get-bucket-lifecycle-configuration" command. For example:
$ aws s3api get-bucket-lifecycle-configuration --bucket 1-1-1-1 --endpoint-url https://s3.us-east-1.myqnapcloud.io
{
"Rules": [
{
"Expiration": {
"Days": 1
},
"ID": "lifecycle_rule_1",
"Filter": {
"And": {
"ObjectSizeGreaterThan": 1,
"ObjectSizeLessThan": 21474836480
}
},
"Status": "Enabled"
},
{
"Expiration": {
"Days": 1
},
"ID": "object_lifecycle_rule_bucket_6807766",
"Filter": {
"Prefix": "1"
},
"Status": "Enabled"
}
]
}
Here is another example:
GET https://s3.us-east-1.myqnapcloud.io/1-1-1-1?lifecycle
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<Expiration>
<Days>1</Days>
</Expiration>
<ID>lifecycle_rule_1</ID>
<Filter>
<And>
<ObjectSizeGreaterThan>1</ObjectSizeGreaterThan>
<ObjectSizeLessThan>21474836480</ObjectSizeLessThan>
</And>
</Filter>
<Status>Enabled</Status>
</Rule>
<Rule>
<Expiration>
<Days>1</Days>
</Expiration>
<ID>object_lifecycle_rule_bucket_6807766</ID>
<Filter>
<Prefix>1</Prefix>
</Filter>
<Status>Enabled</Status>
</Rule>
</LifecycleConfiguration>
Deleting Lifecycle Settings
The lifecycle settings for a bucket can be deleted with the "delete-bucket-lifecycle" command. For example:
$ aws s3api delete-bucket-lifecycle --bucket 1-1-1-1 --endpoint-url https://s3.us-east-1.myqnapcloud.io
There is no response body for this call.
Object Lock
myQNAPcloud Object supports an object lock that prevents the deletion or overwrite of object versions for a fixed amount of time or indefinitely.
| Tag | Description |
|---|
| ObjectLockConfiguration | This is the mandatory root level tag for object lock configuration. |
| ObjectLockEnabled | This tag must be configured as Enabled. |
| Rule | This specifies the object lock rule for a bucket. It requires both a mode and a period. The period can be either Days or Years but you must select one. You cannot specify Days and Years at the same time. Mode should be either COMPLIANCE or GOVERNANCE. |
The object lock settings for a bucket are specified using the “?object-lock” query string along with the object lock settings as the XML body in the request. For example:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/?object-lock HTTP/1.1
<ObjectLockConfiguration>
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>COMPLIANCE</Mode>
<Days>10</Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
The object lock settings for a bucket can be retrieved by getting the bucket with the “?object-lock” query string. For example:
GET https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/?object-lock HTTP/1.1
Response body:
<?xml version="1.0" encoding="UTF-8"?>
<ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>COMPLIANCE</Mode>
<Days>10</Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
There are also object lock settings for each object described in Operations on Objects.
The object lock settings for a bucket can be cleared using "?object-lock" query string. For example:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/?object-lock HTTP/1.1
Response body:
<ObjectLockConfiguration>
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode></Mode>
<Days></Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
myQNAPcloud Object Compliance
myQNAPcloud Object supports a compliance policy that prevents the deletion of objects and provides additional information to prove that the original data is not modified since the time written. The compliance feature may be required for certain regulatory needs, but is also useful to prevent accidental data deletion.
Compliance is different from the object locking setting for a bucket.
You can set the compliance policy on any bucket controlling all the objects that are stored in that bucket. Specify the bucket compliance policy with the following XML tags.
| Tag | Description |
|---|
| Status | Either "enabled" or "disabled" to turn compliance on and off, respectively. Enabling will immediately apply to all objects in the bucket. |
| LockTime | The time at which the compliance settings are "locked"-the settings cannot be reduced by any API call. Once the settings are locked, they cannot be unlocked without the intervention of QNAP Customer Support. The lock time allows you to support two use cases:- Testing that your software works properly before locking the compliance feature; or
- Never locking which means that data can be deleted with an additional step of an administrator turning compliance off.
The lock time parameter may be:- An ISO date (for example, 2016-11-07T15:08:05Z),
- The string "now" to force immediate locking, or
- The string "off to not lock the compliance settings. This is the default.
|
| RetentionDays | An integer for the minimum number of days that objects are always retained after their creation date or release from conditional hold. You can extend the retention date for any individual object, but may not shorten the date. This parameter is always required. |
| ConditionalHold | A Boolean value ("true" or "false") indicating if newly created objects are placed on conditional hold, meaning that they cannot be deleted until the conditional hold is explicitly turned off. The default is false if this parameter is not given. Note that this setting may be changed even after the settings are locked. |
The compliance settings for a bucket are specified using the “?compliance” query string along with the compliance settings as the XML body in the request. For example:
PUT http://s3.us-east-1.myqnapcloud.io/my-bucket?complianceHTTP./1.1
<BucketComplianceConfiguration>
<Status>enabled</Status>
<LockTime>off</LockTime>
<RetentionDays>365</RetentionDays>
<DeleteAfterRetention>true</DeleteAfterRetention>
</BucketComplianceConfiguration>
After compliance is enabled for a bucket, the policy is immediately applied to all objects in the bucket. An attempt to delete an object before the retention period will return an error.
The compliance settings for a bucket can be retrieved by getting the bucket with the “?compliance” query string. For example:
GET http://s3.us-east-1.myqnapcloud.io/my-buck?complianceHTTP/1.1
Response body:
<BucketComplianceConfiguration xml ns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>enabled</Status>
<LockTime>2016-11-07T15:08:05Z</LockTime>
<IsLocked>false</IsLocked>
<RetentionDays>0</RetentionDays>
<ConditionalHold>false</ConditionalHold>
<DeleteAfterRetention>false</DeleteAfterRetention>
</BucketComplianceConfiguration>
There are also compliance settings for each object described in Operations on Objects.
Operations on Buckets Not Supported in myQNAPcloud Object
| Operation | Description |
|---|
| Bucket Tagging | Bucket tagging is currently unavailable in myQNAPcloud Object. |
| Bucket Website | Website configuration is unavailable in myQNAPcloud Object. Given the nature of myQNAPcloud Object as a long-term object store, we do not expect to support website operations to buckets. The header "x-amz-website-redirect-location" is ignored in any object requests. |
| Bucket Accelerate | myQNAPcloud Object does not implement the AWS S3 bucket accelerate subresource. |
| Bucket Request Payment | myQNAPcloud Object does not support the use of the "requestPayment" subresource for buckets. |
| Metrics Configuration | myQNAPcloud Object does not support the operation to receive one-minute CloudWatch metrics, set CloudWatch alarms, and access CloudWatch dashboards to view near-real-time operations and performance of your Amazon S3 storage. |
S3 Block Public Access | myQNAPcloud Object does not support the operation to centrally block existing public access (whether it is made possible via an ACL or a policy) and make sure newly created items are not inadvertently granted public access. |
| S3 Select | myQNAPcloud Object does not support the S3 Select API. |
Operations on Objects With myQNAPcloud Object S3 API
Operations on Objects include renaming, composing, appending, and deleting objects as well as encryption, storage class, object locking, and compliance.
Renaming Objects
myQNAPcloud Object supports functionality to move an object-in effect, renaming the object by changing the key. This eliminates the two-step process of first copying an object and then deleting the original object. The caller must have s3:PutObject policy permission on the bucket to rename objects.
To rename objects, use the HTTP method MOVE along with the following parameters in the request headers that affect the move operation.
|
| Overwrite | A Boolean value that, when “true,” allows overwriting destination objects with the same key. Otherwise, an error is generated and the original key is not changed. |
| X-Wasabi-Quiet | A Boolean value that, when “true,” causes the XML status return body to only display the keys that encounter errors. Otherwise, all objects renamed are given in the status. The default value is “false.” |
| X-Wasabi-Prefix | A Boolean value that, when “true,” means that the values given for the source in the URL and the destination are prefixes—they match the left-most part of keys. Conceptually, think of the prefix as a folder of objects. Otherwise, only the objects (including all versions) that exactly match the key are renamed. The default value is “false.” |
The call will return the results as an XML body of the response. The results include the following for each object renamed:
- original source key,
- renamed destination key,
- version ID of the object, and
- any error in the rename operation.
The quiet option will cause the results to list only the keys that encountered an error.
Below is an example, which renames all objects that start with the prefix “TestMove-Dir2/” to have the new prefix “TestMove-Dir2-Renamed/
MOVE http://s3.us-east-1.myqnapcloud.io/my_bucket/TestMove-Dir2/HTTP/1.1 Destination:TestMove-Dir2-Renamed/X-Wasabi-Prefix:true
Response body:
<MoveObjectResult> <SourcePrefix>TestMove-Dir2/SourcePrefix> <DestinationPrefix>TestMove-Dir2-Renamed/DestinationPrefix> <MoveObject> <SourceKey>TestMove-Dir2/SourceKey> <DestinationKey>TestMove-Dir2-Renamed/DestinationKey> MoveObject> <MoveObject> <SourceKey>TestMove-Dir2/Dir1/SourceKey> <DestinationKey>TestMove-Dir2-Renamed/Dir1/DestinationKey> MoveObject> <MoveObject> <SourceKey>TestMove-Dir2/Dir1/Obj1SourceKey> <DestinationKey>TestMove-Dir2-Renamed/Dir1/Obj1DestinationKey> MoveObject> <MoveObject> <SourceKey>TestMove-Dir2/Dir1/Obj2SourceKey> <DestinationKey>TestMove-Dir2-Renamed/Dir1/Obj2DestinationKey> MoveObject> <MoveObject> <SourceKey>TestMove-Dir2/Dir2/SourceKey> <DestinationKey>TestMove-Dir2-Renamed/Dir2/DestinationKey> MoveObject> <MoveObject> <SourceKey>TestMove-Dir2/Dir2/Obj1SourceKey> <DestinationKey>TestMove-Dir2-Renamed/Dir2/Obj1DestinationKey> MoveObject> <MoveObject> <SourceKey>TestMove-Dir2/Dir2/Obj2SourceKey> <DestinationKey>TestMove-Dir2-Renamed/Dir2/Obj2DestinationKey> MoveObject> <MoveCount>7MoveCount> MoveObjectResult>
Composing Objects
myQNAPcloud Object provides a feature to create a new object that is composed of other objects. A composed object is formed not by copying the original data objects, but rather by linking the composed object to the data objects. This is in contrast to AWS S3, which does not offer a way to compose objects. myQNAPcloud Object operation is much faster and does not require multiple copies of the original data. The original composed objects may be deleted at any time, and the system will retain the original data as long as there are any links to the data.
Composing objects is an alternative to using the multi-part upload feature for creating objects larger than 5 GB. The caller must have s3:PutObject policy permission on the bucket to compose objects. Composed objects may be created from other composed objects as well as original data objects. However, the total number of original data objects may not exceed 32 in any one composed object. Composed objects may only link to other objects in the same bucket.
The compose operation is done using the HTTP method PUT with the query string parameter “?compose” to indicate that the object is composed of objects given in the XML body. The XML body contains a list of object keys and, optionally, the version IDs that form the new object. If the version ID is not given, the latest version of the object is used. The new object will appear to be one object with all the linked data objects concatenated. The new composed object does not have an ETag (i.e, MD5) value, which is the MD5 of the concatenated objects, but rather the result of hashing all the data object MD5s together (like the calculation done when multi-part objects are completed). Composed objects may not have user provided encryption keys. However, all data is stored encrypted at rest.
There is a charge only for the metadata used in composed objects. The original data used in linked objects is charged at the normal rate until all composed objects that link to the original data object are deleted.
Below is an example that composes a new object “TestComp from three objects: “TestCompose-Data-1”, “TestCompose-Data-2”, and “TestCompose-Data-3”.
PUT http://s3.wasabisys.com/my_bucket/TestCompose-Object-1?composeHTTP/1.1Content-Type:text/xml
<ComposeRequest>
<Component>
<Key>TestCompose-Data-1</Key>
</Component>
<Component>
<Key>TestCompose-Data-2</Key>
</Component>
<Component>
<Key>TestCompose-Data-3</Key>
</Component>
</ComposeRequest>
Appending to Objects
AWS S3 does not offer a way to append to objects.
Appending to an existing object is a different form of composing an object (see Composing Objects). The call uploads the data in the body to a temporary object and then creates a new composed object consisting of the data from the original object with the newly uploaded data appended. If the bucket is versioned, a new version of the composed object is created while keeping the original data. When not versioned, the newly composed object replaces the original object. The caller must have s3:PutObject policy permission on the bucket to append to objects. Additionally for a bucket without versioning, the s3:DeleteObject policy permission may be required to replace the original object.
Like composed objects, you can append only 1023 times to any object since each creates a link to the uploaded data. Be careful not to simply append small amounts of data many times to an object since each append data uploaded creates a new object subject to minimum size charges, and can slow down the performance due to a small data read. The append operation is done using the HTTP method PUT with the query string parameter “?append”. The data to be appended is uploaded in the body of the request.
Below is an example that appends the string “<appended data>” to an existing object “TestAppend-Object”.
PUT http://s3.us-east-1.myqnapcloud.io/my-bucket/TestAppend-Object?appendHTTP/1.1Content-Length:15
PUT Object Copy Uses Link
Normally, to rename objects using AWS S3 protocol, an object is uploaded with one key value. Then, a PUT operation with the new key value copied from the original key value is given, and the object for the original key value is deleted.
myQNAPcloud Object automatically optimizes this sequence by linking the new key value object to the original data from the copy key value. This avoids making another copy of the data, which would result in higher storage charges. Because myQNAPcloud Object uses links to the original data, any size object up to the 5 TB limit may be copied and does not require the use of a multi-part upload.
Delete Object MFADelete
If the MFADelete option is turned on in the bucket versioning, the “x-amz-mfa” is not required if the access credentials were signed using MFA (see also MFA (Multi-Factor Authentication) Delete).
If bucket logging is enabled, deleting multiple objects will create a separate log entry for each object that is deleted.
GET Object Response Headers
Any header in the GET object request that starts with “response-” will be returned as a response header (minus the string “response-”).
Object Server-Side Encryption
myQNAPcloud Object encrypts all data stored at rest regardless of the requested encryption. The system will use any caller provided encryption keys when given, or generate a random key encryption key for each object if no customer key is provided. If the customer provides the encryption key, similar to AWS S3, myQNAPcloud Object will not keep a copy of the customer key in the metadata and the caller must provide the encryption key to read the data. No action on the part of the caller is needed if myQNAPcloud Object provides the encryption key.
The caller may provide the encryption key using the headers x-amz-server-side-encryption-customer-algorithm, x-amz-server-side-encryption-customer-key, and x-amz-server-side-encryption-customer-key-MD5. These parameters work identical to AWS S3.
myQNAPcloud Object does not support a key management service. Hence, the “x-amz-server-side-encryption” is not supported along with all the “aws:kms” functionality. myQNAPcloud Object stores an MD5 for the data that is always the uploaded data regardless of server-side encryption.
Object Storage Class
myQNAPcloud Object only provides a single storage class which is most like the standard AWS S3 storage class. Where the storage class is returned in any operation, myQNAPcloud Object will return the standard AWS S3 storage class.
Operations on Objects Not Supported in myQNAPcloud Object
|
| Object RESTORE | myQNAPcloud Object does not support multiple classes of storage and does not support the POST object RESTORE request used to restore objects from a different class of storage. |
| Select Object Content | myQNAPcloud Object does not support the operation to filter the contents of an Amazon S3 object based on a simple structured query language (SQL) statement. |
| S3 Batch Operations | myQNAPcloud Object does not support S3 Batch Operations for object management. |
Compliance with myQNAPcloud Object S3 API
The compliance settings for any one object in a bucket with compliance can also be changed within the limits of the compliance on the bucket. Specify the object compliance settings with the following XML tags.
|
| LegalHold | A Boolean value “true” or “false” to set the legal hold status. When an object has a legal hold status of true, the object cannot be deleted regardless of the retention period. |
| RetentionTime | An ISO time giving a new retention time for the object in which the object cannot be deleted before this time. Note that the new retention time must be past the retention period given by the bucket policy or an error is returned. |
The following is an example of setting the compliance on an object:
PUT http://s3.us-east-1.myqnapcloud.io/my-bucket/my-object?complianceHTTP/1.1
<ObjectComplianceConfiguration>
<ConditionalHold>false</ConditionalHold>
<RetentionTime>2018-03-13T10:45:00Z</RetentionTime>
</ObjectComplianceConfiguration>
The compliance settings for any specific object can also be retrieved using the “?compliance” query string. In addition to the object compliance settings above, the query returns the calculated SHA256 hash for the object, which can be used to determine that the object has not been modified. Note that the SHA256 value is only available for objects that are uploaded as a single object and is not available for multi-part or composed objects.
The following is an example of getting the compliance on an object:
GET http://s3.us-east-1.myqnapcloud.io/my-bucket/my-object?complianceHTTP/1.1
Response body:
<ObjectComplianceConfiguration xml ns="http://s3.amazonaws.com/doc/2006-03-01/">
<RetentionTime>2016-10-31T15:08:05Z</RetentionTime>
<ConditionalHold>false</ConditionalHold>
<LegalHold>false</LegalHold>
<SHA256>14b4be3894e92166b508007b6c2e4fb6e88d3d0ad652c76475089a50ebe6e33b</SHA256>
</ObjectComplianceConfiguration>
The object compliance settings also appear in the bucket listings when the bucket has compliance enabled.
Object Lock with myQNAPcloud Object S3 API
You can add or update the object lock settings for an object using the tags described below.
|
| RetainUntilDate | This defines the retention time for an object. The object cannot be deleted before this time. Note that the retention time must be in the future. |
| LegalHold | This should be either ON or OFF, which is not case-sensitive. |
The following is an example of setting the object locking configuration on an object:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/beta_vpn.png?retention&versionId= 001617181245457483475-4ylsTbqqvP
<Retention>
<Mode>compliance</Mode>
<RetainUntilDate>2021-04-06T09:00:45Z</RetainUntilDate>
</Retention>
The following is an example of setting legal hold for an object:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/beta_vpn.png?legal-hold&versionId=001617181245457483475-4ylsTbqqvP
<LegalHold>
<Status>ON</Status>
</LegalHold>
The following is an example of setting governance mode for an object:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/public/ACL.PNG?retention
<Retention>
<Mode>governance</Mode>
<RetainUntilDate>2021-05-20T09:00:45Z</RetainUntilDate>
</Retention>
The “x-amz-bypass-governance-retention =true” header must be included whenever you want to override governance settings for an object.
Service URLs for myQNAPcloud Object Storage Regions
The myQNAPcloud service URLs for myQNAPcloud Object's different storage regions are:
Americas
| Region | Service URL |
|---|
| US East 1 (N. Virginia) | s3 .us-east-1.myqnapcloud.io |
| US Central 1 (Texas) | s3.us-central-1. myqnapcloud.io |
| US West 1 (Oregon) | s3.us-west-1. myqnapcloud.io |
| CA Central 1 (Toronto) | s3.ca-central-1. myqnapcloud.io |
EMEA
| EU Central 1 (Amsterdam) | s3.eu-central-1. myqnapcloud.io |
| EU Central 2 (Frankfurt) | s3.eu-central-2. myqnapcloud.io |
| EU West 1 (London) | s3.eu-west-1. myqnapcloud.io |
| EU West 2 (Paris) | s3.eu-west-2. myqnapcloud.io |
| EU West 3 (London) | s3.eu-west-3. myqnapcloud.io |
| EU South 1 (Milan) | s3.eu-south-1. myqnapcloud.io |
APAC
| AP Northeast 1 (Tokyo) | s3.ap-northeast-1. myqnapcloud.io |
| AP Northeast 2 (Osaka) | s3.ap-northeast-2. myqnapcloud.io |
| AP Southeast 1 (Singapore) | s3.ap-southeast-1. myqnapcloud.io |
| AP Southeast 2 (Sydney) | s3.ap-southeast-2. myqnapcloud.io |
The myQNAPcloud Object Management Console can be reached through myQNAPcloud Portal.
If you are looking for the correct service URL to use with your third-party storage application, you should choose the one that matches your bucket location.
When working with third-party storage applications, you should be aware that these applications have different methods to handle storage region service URLs. These methods include:
- Applications that allow you to explicitly enter in the service URL. These applications are the most flexible because you can easily configure new service URLs as they become available.
- Applications that only allow you to choose from a pre-built list of storage regions. These applications are the least flexible because, if a storage provider implements a new region, you have to wait for an application update to get access to the new region. If your storage application does not support all of the myQNAPcloud Object storage regions on their predefined region lists, contact the application vendor (not QNAP) to ask them for support.
- Applications that only allow you to enter in your API key set and then offer up all of the buckets in your account. These applications provide flexibility but do require some automatic redirects to perform at the HTTP level.
Object Replication with myQNAPcloud Object S3 API
GET Object Tagging
myQNAPcloud Object supports functionality to fetch the tag set of an object when the object:
- Does not have any tags
- Does have tags
When the Object Does Not Have Any Tags
GET https://s3.myqnapcloud.io/my_bucket/Test-object1.txt?tagging
Response body:
<?xml version="1.0" encoding="UTF-8"?>
<Tagging>
<TagSet></TagSet>
</Tagging>
Status 200 OK
When the Object Has Tags
GET https://s3.myqnapcloud.io/my_bucket/Test-object2.pdf?tagging
Response body:
<!--?xml version="1.0" encoding="UTF-8"?-->
<Tagging>
<TagSet>
<Tag>
<Key>key2</Key>
<Value>value2</Value>
</Tag>
<Tag>
<Key>key1</Key>
<Value>value1</Value>
</Tag>
</TagSet>
</Tagging>
PUT Object Tagging
myQNAPcloud Object supports functionality for:
- Adding the tag value of an existing object in a bucket
- Appending the tag value of an existing object in a bucket
Adding the Tag Value of an Existing Object in a Bucket
PUT https://s3.myqnapcloud.io/my_bucket/Test-object3.pdf?tagging
Content-Type: text/xml
Response body:
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>tag1</Key>
<Value>value1</Value>
</Tag>
</TagSet>
</Tagging>
Appending the Tag Value of an Existing Object in a Bucket
In this example, an existing object already has the tag value of “key5” –“value5”, You can append a new tag pairs along with the existing pair.
PUT https://s3.myqnapcloud.io/my_bucket/Test-object4.jpg?tagging
Content-Type: text/xml
Response body:
<Tagging xmlns="http://s3.myqnapcloud.io/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>key5</Key>
<Value>value5</Value>
</Tag>
<Tag>
<Key>key6</Key>
<Value>value6</Value>
</Tag>
</TagSet>
</Tagging>
Status 200 OK
To PUT tags of any other version, use the versionId query parameter.
DELETE Object Tagging
This removes the entire tag set from the specified object.
DELETE https://s3.myqnapcloud.io/my_bucket/Test-object5.pdf?tagging
Response body:
<empty>
Status 204 No Content
To delete tags of any other version, use the versionId query parameter.
Object Tagging with myQNAPcloud Object API
Get Object Tagging
myQNAPcloud Object supports functionality to fetch the tag set of an object when the object:
- Does not have any tags
- Does have tags
When the object does not have any tags
GET
https://s3.myqnapcloud.io/my_bucket/Test-object1.txt?tagging
Response body:
<?xml version="1.0" encoding="UTF-8"?>
<Tagging>
<TagSet></TagSet>
</Tagging>
Status 200 OK
When the object has Tags
GET
https://s3.myqnapcloud.io/my_bucket/Test-object2.pdf?tagging
Response body:
<!--?xml version="1.0" encoding="UTF-8"?-->
<Tagging>
<TagSet>
<Tag>
<Key>key2</Key>
<Value>value2</Value>
</Tag>
<Tag>
<Key>key1</Key>
<Value>value1</Value>
</Tag>
</TagSet>
</Tagging>
PUT Object Tagging
myQNAPcloud Object supports functionality for:
- Adding the tag value of an existing object in a bucket
- Appending the tag value of an existing object in a bucket
Adding the tag value of an existing object in a bucket
PUT
https://s3.myqnapcloud.io/my_bucket/Test-object3.pdf?tagging
Content-Type: text/xml
Response body:
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>tag1</Key>
<Value>value1</Value>
</Tag>
</TagSet>
</Tagging>
Appending the Tag Value of an Existing Object in a Bucket
In this example, an existing object already has the tag value of “key5” –“value5”, You can append a new tag pair along with the existing pair.
PUT
https://s3.myqnapcloud.io/my_bucket/Test-object4.jpg?tagging
Content-Type: text/xml
Response body:
<Tagging xmlns="http://s3.myqnapcloud.io/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>key5</Key>
<Value>value5</Value>
</Tag>
<Tag>
<Key>key6</Key>
<Value>value6</Value>
</Tag>
</TagSet>
</Tagging>
Status 200 OK
To PUT tags of any other version, use the versionId query parameter.
DELETE Object Tagging
This removes the entire tag set from the specified object.
DELETE
https://s3.myqnapcloud.io/my_bucket/Test-object5.pdf?tagging
Response body:
<empty>
Status 204 No Content
To delete tags of any other version, use the versionId query parameter.
Further Reading
Given its compatibility with AWS S3, the official AWS documentation for S3 serves as a complementary resource when working with myQNAPcloud Object. Refer to the Amazon Simple Storage Service API Reference for details on the API version 2006-03-01:
Amazon Simple Storage Service API Reference
適用產品
myQNAPcloud Object
什麼是 myQNAPcloud Object?
myQNAPcloud Object 是一種基於雲端的物件儲存空間服務,旨在為各種應用和使用案例提供高效能、可靠且安全的數據儲存空間。此服務完全相容於 Amazon Web Service Simple 儲存空間 Service (AWS S3) API,確保與 S3 相容的應用程式和閘道裝置無縫整合。
myQNAPcloud Object 專為尋求具成本效益且高效數據儲存空間基礎設施的個人和組織量身打造。設計用於與 S3 相容的應用程式,myQNAPcloud Object 使用戶能夠利用熟悉的工具和工作流程,同時受益於 QNAP 生態系統的可靠性和靈活性。
- 相容性: myQNAPcloud Object 設計完全相容於 AWS S3 API,確保現有的 AWS S3 相容應用程式能夠無縫運作。
- 效能: myQNAPcloud Object 提供高效能的儲存空間解決方案,優化於可靠性和效率。
關於 myQNAPcloud Object S3 API 指南
雖然 myQNAPcloud Object 與 AWS S3 密切對齊,但某些功能可能已增強或以不同方式實現。本指南旨在闡明這些細微差異,以幫助用戶最大化 myQNAPcloud Object 的潛力。
本指南使用涉及在特定 myQNAPcloud Object 區域中訪問貯體的範例。欲了解更多關於區域特定端點和服務 URL 的資訊,請參閱「myQNAPcloud Object 儲存空間區域的服務 URL」。
註
- 區域 URL: 當訪問貯體時,請確保使用特定於您建立存放區的 myQNAPcloud Object 儲存空間區域的 URL。使用不正確的 URL 可能允許 GET 請求,但可能導致 PUT 或 DELETE 操作的錯誤。請參閱 [myQNAPcloud Object 儲存空間區域的服務 URL]。
- ASW IAM: 與 AWS 不同,myQNAPcloud Object 不支援 AWS IAM(身份與存取管理)。因此,本指南專注於 S3 API 相容性,不涉及 IAM 相關功能。
REST API 介紹
主機指定
myQNAPcloud Object 支援與 AWS S3 類似的路徑樣式和虛擬樣式請求。需要一個唯一的主機名稱(例如,s3.us-east-1.myqnapcloud.io 與 s3.amazonaws.com)。我們建議使用路徑樣式請求,如本指南中的所有範例所示(例如,http://s3.us-east-1.myqnapcloud.io/my-bucket/my-object),因為路徑樣式請求在桶名稱上提供更大的靈活性,避免域名衝突。
始終一致
與 AWS S3 的強一致性模型不同,myQNAPcloud Object 提供所有操作的「始終一致」視圖。這確保任何操作之後的操作都會產生一致的結果。例如,在刪除物件(DELETE 操作)後,執行後續的 HEAD 請求將始終確認物件已刪除,無需額外的程式設計來等待操作完成。
驗證請求
myQNAPcloud Object 支援與 AWS S3 相容的自主和簽名版本 2 和 4,用於標頭和查詢參數。雖然簽名版本 4 提供更好的安全性,但由於計算 SHA256 雜湊的開銷,需要更多的計算資源。如果性能至關重要,可以使用簽名版本 2,並使用 MD5(作為 ETag 標頭返回)確保數據完整性。
對於版本 4 簽名請求,所有地區均支援 myQNAPcloud Object 簽名請求。
myQNAPcloud Object 不支援瀏覽器上傳或 HTML 表單請求的簽名,因為這些操作目前不支援。
對於版本 2 簽名,以下子資源鍵作為查詢引數在請求中指定:
- append
- compose
- force_delete=true
這些查詢引數必須在計算 PutObject 和 DeleteBucket 操作的簽名時包含。
錯誤回應
在可能的情況下,myQNAPcloud Object 使用與 AWS S3 相容的錯誤回應。也可能提供其他錯誤代碼以增強功能。
HTTP 錯誤程式碼
| 錯誤程式碼 | myQNAPcloud Object 說明 | HTTP 狀態碼 |
|---|
| 無法使用 | 暫時無法使用 | 503 |
| 無法恢復 | 資料無法恢復 |
|
| 未實作 | 未實作 | 501 |
| 資料庫實體未找到 | 無此實體 | 404 |
| 資料庫實體已找到 | 實體已存在 | 409 |
| 斷線錯誤 | 連線已關閉 | 410 |
| 狀態內部伺服器錯誤 | 內部錯誤:我們遇到了一個內部錯誤。請聯絡客戶支援。 | 500 |
| 狀態禁止 | 拒絕存取 | 403 |
| 禁止存取 |
| 帳戶未啟用 |
| 帳戶問題 |
| 驗證鎖定:嘗試使用錯誤的憑證訪問帳戶的次數過多。請五分鐘後再試。 |
| 無效的訪問金鑰 ID:您提供的 AWS 訪問金鑰 ID 不存在於我們的記錄中。 |
| 無效的驗證碼:裝置的驗證碼無效。 |
| 請求時間偏差過大:請求時間與當前時間的差異過大。 |
| 無效的物件狀態:該操作對於物件的當前狀態無效。 |
| 狀態錯誤請求 | 授權標頭格式錯誤 | 400 |
| 授權查詢引數錯誤 |
| 錯誤的摘要:您指定的 Content-MD5 與我們收到的不匹配。 |
| 錯誤請求:解析 HTTP 請求時發生錯誤。 |
| 簽名不完整:請求必須包含符合 AWS 標準的簽名。 |
| 無效的操作 |
| 無效的引數 |
| 無效的摘要:您指定的 Content-MD5 無效。 |
| 無效的輸入 |
| 無效的引數值:為輸入引數提供了無效或超出範圍的值。 |
| 無效的請求 |
| 格式錯誤的政策 |
| 格式錯誤的政策檔案 |
| 密碼政策違規 |
| 驗證錯誤 |
| X Amz Content SHA256 不匹配:提供的 'x-amz-content-sha256' 標頭與計算結果不匹配。 |
| 不允許加密:此操作不允許使用者提供加密金鑰。 |
| 物件使用伺服器端加密形式儲存。必須提供正確的引數以檢索物件。 |
| 實體過大:您提議的上傳超過了允許的最大大小。 |
| 實體過小:您提議的上傳小於允許的最小大小。 |
| 非法合規請求 |
| 非法版本控制配置異常:請求中指定的版本控制配置無效。 |
| 主體不完整:您未提供 Content-Length HTTP 標頭指定的位元組數。 |
| 無效的 ACL 請求:設定 ACL 時,您必須僅提供 ACL 標頭或 XML 主體之一。 |
| 無效的引數 |
| 無效的貯體名稱:指定的貯體無效。 |
| 無效的加密演算法錯誤:您指定的加密請求無效。支援的值:AES256。 |
| 無效的部分順序:部分列表不是按升序排列。部分必須按部分號排序。 |
| 無效的部分:無法找到指定的部分之一或多個。部分可能未上傳,或指定的實體標籤可能與部分的實體標籤不匹配。 |
| 無效的政策檔案:表單的內容不符合政策檔案中指定的條件。 |
| 金鑰過長錯誤:您的金鑰過長。 |
| 記錄貯體相同擁有者:記錄目標貯體必須與被記錄的貯體擁有相同的擁有者。 |
| XML 格式錯誤:您提供的 XML 格式不正確或未透過我們發布的架構驗證。 |
| 中繼資料過大:您的中繼資料標頭超過允許的最大中繼資料大小。 |
| 請求逾時:您與伺服器的連線在逾時期間內未被讀取或寫入。 |
| 過多的貯體:您嘗試創建的貯體超過允許的數量。 |
| 元件過多:複合物件不得超過 1024 個元件。 |
| 無法解析的電子郵件授權:您提供的電子郵件地址與記錄中的任何帳戶不匹配。 |
| 儲存空間配額超出:您的帳戶已超過其儲存空間限制。 |
| 儲存貯體帳戶未啟用:擁有此儲存貯體的帳戶未啟用。 |
| 狀態消失 | 連線關閉:網路連線已關閉。 | 410 |
| 狀態無法處理的實體 | 資料無法恢復:請求中的資料無法恢復。請聯絡客戶支援。 | 422 |
| 狀態衝突 | 刪除衝突 | 409 |
| 實體已存在 |
| 實體暫時無法修改:實體暫時無法修改。請稍後再試。 |
| 超出限制 |
| 操作中止:目前有一個衝突的條件操作正在針對此資源進行。請再試一次。 |
| 儲存貯體已存在 |
| 儲存貯體不為空 |
| 合規設定已鎖定:合規設定現在已鎖定,無法更改。 |
| 狀態未找到 | 無此實體 | 404 |
| 無此生命週期配置:生命週期配置不存在。 |
| 無此儲存貯體:指定的儲存貯體不存在。 |
| 無此儲存貯體政策:儲存貯體政策不存在。 |
| 無此金鑰:指定的金鑰不存在。 |
| 無此複製配置:複製配置不存在。 |
| 無此標籤集錯誤:儲存貯體沒有關聯的標籤集。 |
| 無此上傳:指定的上傳不存在。上傳 ID 可能無效,或上傳可能已中止或完成。 |
| 無此版本:指定的版本不存在。 |
| 狀態未實作 | 未實作:您提供的標頭暗示未實作的功能。 | 501 |
| 狀態服務不可用 | 暫時不可用:此操作的資源暫時不可用。請稍後再試。 | 503 |
| 狀態找到 | 金鑰已存在 | 302 |
| 狀態方法不允許 | 方法不允許:此方法僅允許帳戶擁有者使用。 | 405 |
| 方法不允許:指定的方法不允許對此資源使用。 |
| 狀態需要長度 | 缺少內容長度:您必須提供 Content-Length HTTP 標頭。 | 411 |
TCP 錯誤程式碼
myQNAPcloud Object 支援以下 TCP 錯誤代碼:
在 myQNAPcloud Object 中不支援
| 操作 | 說明 |
|---|
| SOAP | AWS S3 已停止支援 SOAP,且 myQNAPcloud Object 不支援任何 SOAP 操作。 |
使用 myQNAPcloud Object S3 API 對貯體的操作
對貯體的操作包括:刪除、重命名、記錄貯體,以及跨來源資源共享 (CORS) 支援、生命週期政策、物件鎖定和合規性。
強制刪除貯體
AWS S3 不允許您刪除包含未刪除物件的貯體。
myQNAPcloud Object 提供強制刪除選項,會先刪除貯體中的所有物件,然後再刪除貯體。物件的刪除需符合貯體的政策和合規性要求。
要使用強制刪除選項,只需將其作為查詢字串新增。例如:
DELETE http://s3.us-east-1.myqnapcloud.io/my-bucket?force_delete=true HTTP/1.1
重新命名貯體
AWS S3 不支援重命名貯體。它僅支援重命名貯體中的物件。
myQNAPcloud Object 支援重命名貯體。新的貯體名稱必須未被使用,重命名才能成功。呼叫者必須擁有 s3:CreateBucket 政策權限才能重命名貯體。
要重新命名貯體,使用 HTTP 方法 MOVE 並搭配標頭欄位「Destination」來提供新的貯體名稱。例如:
MOVE http://s3.us-east-1.myqnapcloud.io/my_old_bucket HTTP/1.1
Destination: my_new_bucket
MFA (多重因素驗證) 刪除
myQNAPcloud Object 支援 "x-amz-mfa" 標頭,當:
- 在貯體上配置版本控制,或
- 使用與 AWS S3 相容的物件刪除請求刪除物件時。
如果用戶的存取憑證已通過 MFA 驗證來簽署請求,myQNAPcloud Object 不需要 "x-amz-mfa" 標頭。myQNAPcloud Object 僅支援虛擬 MFA 裝置。
貯體的最大數量
標準 AWS S3 僅支援 100 個貯體。
myQNAPcloud Object 每個帳戶允許最多 1000 個貯體,此數量可透過聯絡 myQNAPcloud Object 客戶支援來增加。
貯體記錄
myQNAPcloud Object 支援貯體記錄功能,會建立所有存取貯體的文字記錄檔。記錄檔的格式與 AWS S3 記錄檔相同。
myQNAPcloud Object 貯體記錄不需要任何 ACL 權限設定即可將記錄儲存在目標貯體中。雖然您可以在記錄請求或 ACL 中設定權限,但在 myQNAPcloud Object 中記錄運作並不需要這些設定。然而,作為記錄檔目標的貯體必須與被記錄的貯體在同一個帳戶中。
貯體跨來源資源共享 (CORS) 支援
為了與瀏覽器存取 myQNAPcloud Object 作為網頁伺服器的相容性,當 HTTP 請求中給出 "Origin" 標頭時,myQNAPcloud Object 伺服器將返回 CORS 標頭。此外,伺服器支援在貯體或物件上使用 HTTP 方法 OPTIONS,以返回瀏覽器在存取 myQNAPcloud Object 前進行預檢測試所需的 CORS 標頭。
與 AWS 不同,myQNAPcloud Object 返回的設定將允許瀏覽器完全存取 myQNAPcloud Object。因此,myQNAPcloud Object 不支援 AWS 函數,這些函數允許在 URL 中使用 "cors" 參數對貯體進行 PUT 和 GET。請注意,允許瀏覽器完全存取資料不會影響對任何物件的存取安全性,所有存取政策仍將被執行。
當 HTTP 請求中給出 "Origin" 標頭時,預設返回的 HTTP 標頭如下:
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, MOVE, OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Access-Control-Max-Age: 86400
生命週期政策
生命週期功能建立生命週期政策,透過規則定義您希望 myQNAPcloud Object 在物件生命週期中執行的動作。此功能取代了在保留期後手動刪除物件的需求。
設定生命週期設定
儲存貯體的生命週期設定是使用 "put-bucket-lifecycle-configuration" 指令進行配置。例如:
$ aws s3api put-bucket-lifecycle-configuration --bucket 1-1-1-1 --endpoint-url https://s3.us-east-1.myqnapcloud.io --lifecycle-configuration file://lifecycle.json
{
"Rules": [
{
"Expiration": {"Days": 1},
"ID": "lifecycle_rule_1",
"Filter": {
"And": {
"ObjectSizeGreaterThan": 1,
"ObjectSizeLessThan": 21474836480
}
},
"Status": "Enabled"
},
{
"Expiration": {"Days": 1},
"ID": "object_lifecycle_rule_bucket_6807766",
"Filter": {"Prefix": "1"},
"Status": "Enabled"
}
]
}
這裡是另一個例子:
PUT https://s3.us-east-1.myqnapcloud.io/1-1-1-1?lifecycle <lifecycleconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <rule> <expiration> <days>1</days> </expiration> <id>lifecycle_rule_1</id> <filter> <and> <objectsizegreaterthan>1</objectsizegreaterthan> <objectsizelessthan>21474836480</objectsizelessthan> </and> </filter> <status>Enabled</status> </rule> <rule> <expiration> <days>1</days> </expiration> <id>object_lifecycle_rule_bucket_6807766</id> <filter> <prefix>1</prefix> </filter> <status>Enabled</status> </rule> </lifecycleconfiguration>
此呼叫沒有回應主體。
檢索生命週期設定
可以使用 "get-bucket-lifecycle-configuration" 指令檢索儲存桶的生命週期設定。例如:
$ aws s3api get-bucket-lifecycle-configuration --bucket 1-1-1-1 --endpoint-url https://s3.us-east-1.myqnapcloud.io
{
"Rules": [
{
"Expiration": {"Days": 1},
"ID": "lifecycle_rule_1",
"Filter": {
"And": {
"ObjectSizeGreaterThan": 1,
"ObjectSizeLessThan": 21474836480
}
},
"Status": "Enabled"
},
{
"Expiration": {"Days": 1},
"ID": "object_lifecycle_rule_bucket_6807766",
"Filter": {"Prefix": "1"},
"Status": "Enabled"
}
]
}
這是另一個例子:
GET https://s3.us-east-1.myqnapcloud.io/1-1-1-1?lifecycle <?xml version="1.0" encoding="UTF-8"?> <lifecycleconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <rule> <expiration> <days>1</days> </expiration> <id>lifecycle_rule_1</id> <filter> <and> <objectsizegreaterthan>1</objectsizegreaterthan> <objectsizelessthan>21474836480</objectsizelessthan> </and> </filter> <status>Enabled</status> </rule> <rule> <expiration> <days>1</days> </expiration> <id>object_lifecycle_rule_bucket_6807766</id> <filter> <prefix>1</prefix> </filter> <status>Enabled</status> </rule> </lifecycleconfiguration>
刪除生命週期設定
可以使用 "delete-bucket-lifecycle" 指令刪除貯體的生命週期設定。例如:
$ aws s3api delete-bucket-lifecycle --bucket 1-1-1-1 --endpoint-url https://s3.us-east-1.myqnapcloud.io
此呼叫沒有回應主體。
物件鎖定
myQNAPcloud Object 支援物件鎖定,可防止物件版本在固定時間內或無限期被刪除或覆寫。
| 標籤 | 說明 |
|---|
| ObjectLockConfiguration | 這是物件鎖定設定的必須根層級標籤。 |
| ObjectLockEnabled | 此標籤必須設定為 Enabled。 |
| 規則 | 這指定了貯體的物件鎖定規則。它需要一個模式和一個期間。期間可以是天或年,但您必須選擇一個。您不能同時指定天和年。 模式應為 COMPLIANCE 或 GOVERNANCE。 |
貯體的物件鎖定設定是使用 "?object-lock" 查詢字串以及物件鎖定設定作為請求中的 XML 主體來指定的。例如:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/?object-lock HTTP/1.1 <objectlockconfiguration> <objectlockenabled>Enabled</objectlockenabled> <rule> <defaultretention> <mode>COMPLIANCE</mode> <days>10</days> </defaultretention> </rule> </objectlockconfiguration>
可以通過使用 "?object-lock" 查詢字串來獲取貯體的物件鎖定設定。例如:
GET https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/?object-lock HTTP/1.1
回應主體:
<?xml version="1.0" encoding="UTF-8"?> <objectlockconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <objectlockenabled>Enabled</objectlockenabled> <rule> <defaultretention> <mode>COMPLIANCE</mode> <days>10</days> </defaultretention> </rule> </objectlockconfiguration>
每個物件也有物件鎖定設定,描述於物件操作。
可以使用 "?object-lock" 查詢字串來清除貯體的物件鎖定設定。例如:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/?object-lock HTTP/1.1
回應主體:
<objectlockconfiguration> <objectlockenabled>啟用</objectlockenabled> <rule> <defaultretention> <mode></mode> <days></days> </defaultretention> </rule> </objectlockconfiguration>
myQNAPcloud Object 合規
myQNAPcloud Object 支援一項合規政策,該政策可防止物件被刪除,並提供額外資訊以證明自寫入以來原始資料未被修改。合規功能可能是某些法規需求所必需的,但也有助於防止意外資料刪除。
合規與貯體的物件鎖定設定不同。
您可以在任何貯體上設定合規政策,以控制儲存在該貯體中的所有物件。使用以下 XML 標籤指定貯體合規政策。
| 標籤 | 說明 |
|---|
| 狀態 | 使用 "enabled" 或 "disabled" 來分別開啟或關閉合規。啟用後將立即應用於貯體中的所有物件。 |
| 鎖定時間 | 合規設定被 "鎖定" 的時間——設定無法透過任何 API 呼叫減少。一旦設定被鎖定,除非 QNAP 客戶支援介入,否則無法解鎖。鎖定時間允許您支援兩種使用情境:- 在鎖定合規功能之前測試您的軟體是否正常運作;或
- 從不鎖定,這意味著可以通過額外步驟由系統管理員關閉合規來刪除資料。
鎖定時間引數可能是:- ISO 日期(例如,2016-11-07T15:08:05Z),
- 字串 "now" 以強制立即鎖定,或
- 字串 "off to not lock the compliance settings. This is the default.
|
| RetentionDays | 一個整數,表示物件在建立日期或解除條件保留後始終保留的最少天數。您可以延長任何單個物件的保留日期,但不能縮短日期。此引數是必需的。 |
| ConditionalHold | 一個布林值("true" 或 "false"),指示新建立的物件是否處於條件保留狀態,這意味著在明確關閉條件保留之前,這些物件不能被刪除。如果未提供此引數,則預設為 false。請注意,即使在設定被鎖定後,此設定也可以更改。 |
貯體的合規設定是使用 "?compliance" 查詢字串以及請求中的 XML 主體來指定的。例如:
PUT http://s3.us-east-1.myqnapcloud.io/my-bucket?complianceHTTP./1.1 <bucketcomplianceconfiguration> <status>enabled</status> <locktime>off</locktime> <retentiondays>365</retentiondays> <deleteafterretention>true</deleteafterretention> </bucketcomplianceconfiguration>
在貯體啟用合規性後,策略會立即應用於貯體中的所有物件。嘗試在保留期之前刪除物件將返回錯誤。
可以透過使用 "?compliance" 查詢字串獲取貯體來檢索貯體的合規設定。例如:
GET http://s3.us-east-1.myqnapcloud.io/my-buck?complianceHTTP/1.1
回應主體:
<bucketcomplianceconfiguration xml ns="http://s3.amazonaws.com/doc/2006-03-01/"> <status>enabled</status> <locktime>2016-11-07T15:08:05Z</locktime> <islocked>false</islocked> <retentiondays>0</retentiondays> <conditionalhold>false</conditionalhold> <deleteafterretention>false</deleteafterretention> </bucketcomplianceconfiguration>
每個物件的合規設定也在物件操作中描述。
貯體上的操作在 myQNAPcloud Object 中不支援
| 操作 | 說明 |
|---|
| Bucket 標籤 | 目前在 myQNAPcloud Object 中無法使用 Bucket 標籤。 |
| Bucket 網站 | 在 myQNAPcloud Object 中無法使用網站設定。由於 myQNAPcloud Object 作為長期物件存儲的特性,我們不預期支援網站操作至貯體。在任何物件請求中,標頭 "x-amz-website-redirect-location" 將被忽略。 |
| Bucket 加速 | myQNAPcloud Object 未實作 AWS S3 bucket 加速子資源。 |
| Bucket 請求付款 | myQNAPcloud Object 不支援對貯體使用 "requestPayment" 子資源。 |
| 指標設定 | myQNAPcloud Object 不支援接收一分鐘 CloudWatch 指標、設置 CloudWatch 警報及存取 CloudWatch 儀表板以查看 Amazon S3 儲存空間的近實時操作和效能的操作。 |
S3 公共訪問封鎖 | myQNAPcloud Object 不支援集中封鎖現有公共訪問(無論是透過 ACL 還是政策實現),並確保新創建的項目不會被意外授予公共訪問的操作。 |
| S3 選擇 | myQNAPcloud Object 不支援 S3 Select API。 |
使用 myQNAPcloud Object S3 API 的物件操作
物件操作包括重新命名、組合、附加和刪除物件,以及加密、儲存空間類別、物件鎖定和合規性。
重新命名物件
myQNAPcloud Object 支援移動物件的功能,實際上是透過更改鍵來重新命名物件。這消除了先複製物件再刪除原始物件的兩步驟過程。呼叫者必須在儲存桶上擁有 s3:PutObject 政策許可權才能重新命名物件。
要重新命名物件,請使用 HTTP 方法 MOVE,並在請求標頭中使用以下影響移動操作的引數。
|
| 覆寫 | 一個布林值,當為“true”時,允許覆寫具有相同鍵的目標物件。否則,將產生錯誤,且原始鍵不會更改。 |
| X-Wasabi-Quiet | 一個布林值,當為“true”時,XML 狀態返回體僅顯示遇到錯誤的鍵。否則,所有重新命名的物件都會在狀態中顯示。預設值為“false”。 |
| X-Wasabi-Prefix | 一個布林值,當為“true”時,表示 URL 中給定的來源和目標是字首——它們匹配鍵的最左部分。概念上,將字首視為物件的資料夾。否則,只有完全匹配鍵的物件(包括所有版本)會被重新命名。預設值為“false”。 |
呼叫將以 XML 體的形式返回響應結果。結果包括每個重新命名物件的以下內容:
- 原始來源鍵,
- 重新命名的目標鍵,
- 物件的版本 ID,和
- 重新命名操作中的任何錯誤。
安靜選項將導致結果僅列出遇到錯誤的鍵。
以下是一個範例,將所有以字首「TestMove-Dir2/」開頭的物件重新命名為新字首「TestMove-Dir2-Renamed/
MOVE http://s3.us-east-1.myqnapcloud.io/my_bucket/TestMove-Dir2/HTTP/1.1 目標:TestMove-Dir2-Renamed/X-Wasabi-Prefix:true
回應主體:
<moveobjectresult> <sourceprefix>TestMove-Dir2/SourcePrefix> <destinationprefix>TestMove-Dir2-Renamed/DestinationPrefix> <moveobject> <sourcekey>TestMove-Dir2/SourceKey> <destinationkey>TestMove-Dir2-Renamed/DestinationKey> MoveObject> <moveobject> <sourcekey>TestMove-Dir2/Dir1/SourceKey> <destinationkey>TestMove-Dir2-Renamed/Dir1/DestinationKey> MoveObject> <moveobject> <sourcekey>TestMove-Dir2/Dir1/Obj1SourceKey> <destinationkey>TestMove-Dir2-Renamed/Dir1/Obj1DestinationKey> MoveObject> <moveobject> <sourcekey>TestMove-Dir2/Dir1/Obj2SourceKey> <destinationkey>TestMove-Dir2-Renamed/Dir1/Obj2DestinationKey> MoveObject> <moveobject> <sourcekey>TestMove-Dir2/Dir2/SourceKey> <destinationkey>TestMove-Dir2-Renamed/Dir2/DestinationKey> MoveObject> <moveobject> <sourcekey>TestMove-Dir2/Dir2/Obj1SourceKey> <destinationkey>TestMove-Dir2-Renamed/Dir2/Obj1DestinationKey> MoveObject> <moveobject> <sourcekey>TestMove-Dir2/Dir2/Obj2SourceKey> <destinationkey>TestMove-Dir2-Renamed/Dir2/Obj2DestinationKey> MoveObject> <movecount>7MoveCount> MoveObjectResult>
組合物件
myQNAPcloud Object 提供一項功能來建立由其他物件組成的新物件。組合物件的形成不是通過複製原始資料物件,而是通過將組合物件連結到資料物件來實現。這與 AWS S3 不同,AWS S3 不提供組合物件的方法。myQNAPcloud Object 操作速度更快,且不需要多次複製原始資料。原始組合物件可以隨時刪除,只要有任何連結到資料,系統將保留原始資料。
組合物件是使用多部分上傳功能來建立大於 5 GB 物件的替代方案。呼叫者必須在儲存桶上擁有 s3:PutObject 政策許可權才能組合物件。 組合物件可以由其他組合物件以及原始資料物件創建。然而,任何一個組合物件中的原始資料物件總數不得超過 32 個。組合物件只能連結到同一個儲存桶中的其他物件。
組合操作是使用 HTTP 方法 PUT 並帶有查詢字串引數 "?compose" 來完成,以指示物件是由 XML 主體中給定的物件組成。XML 主體包含物件鍵的列表,並可選擇性地包含構成新物件的版本 ID。如果未提供版本 ID,則使用物件的最新版本。新物件將顯示為一個物件,所有連結的資料物件將被串接在一起。新的組合物件沒有 ETag(即 MD5)值,這是串接物件的 MD5,而是將所有資料物件的 MD5 一起雜湊的結果(類似於完成多部分物件時的計算)。組合物件可能沒有使用者提供的加密金鑰。然而,所有資料在靜止時都是加密儲存的。
只有組合物件中使用的中繼資料會產生費用。連結物件中使用的原始資料會以正常費率計費,直到所有連結到原始資料物件的組合物件被刪除為止。
以下是一個範例,將三個物件 "TestCompose-Data-1"、"TestCompose-Data-2" 和 "TestCompose-Data-3" 組合成一個新物件 "TestComp"。
PUT http://s3.wasabisys.com/my_bucket/TestCompose-Object-1?composeHTTP/1.1Content-Type:text/xml <composerequest> <component> <key>TestCompose-Data-1</key> </component> <component> <key>TestCompose-Data-2</key> </component> <component> <key>TestCompose-Data-3</key> </component> </composerequest>
附加到物件
AWS S3 不提供附加到物件的方法。
附加到現有物件是組合物件的另一種形式(請參閱組合物件)。該呼叫將資料上傳到一個臨時物件,然後建立一個新的組合物件,其中包含原始物件的資料和新上傳的資料。如果儲存桶有版本控制,則會建立一個新的組合物件版本,同時保留原始資料。當沒有版本控制時,新組合物件將取代原始物件。呼叫者必須在儲存桶上擁有 s3:PutObject 政策許可權才能附加到物件。此外,對於沒有版本控制的儲存桶,可能需要 s3:DeleteObject 政策許可權來取代原始物件。
像組合物件一樣,您只能對任何物件附加 1023 次,因為每次都會建立一個到上傳資料的連結。請注意,不要簡單地多次附加少量資料到物件,因為每次附加資料上傳都會建立一個新的物件,這會產生最低大小收費,並可能因小資料讀取而降低效能。 附加操作是使用 HTTP 方法 PUT 和查詢字串引數“?append”完成的。要附加的資料上傳在請求的主體中。
以下是一個將字串“”附加到現有物件“TestAppend-Object”的範例。
PUT http://s3.us-east-1.myqnapcloud.io/my-bucket/TestAppend-Object?appendHTTP/1.1Content-Length:15
PUT 物件複製使用連結
通常,使用 AWS S3 協議重新命名物件時,會使用一個鍵值上傳物件。然後,使用從原始鍵值複製的新鍵值進行 PUT 操作,並刪除原始鍵值的物件。
myQNAPcloud Object 自動優化此序列,通過將新鍵值物件連結到複製鍵值的原始資料。這避免了再次複製資料,從而導致更高的儲存空間收費。因為 myQNAPcloud Object 使用連結到原始資料,任何大小的物件最多可達 5 TB 限制都可以被複製,且不需要使用多部分上傳。
刪除物件 MFADelete
如果在儲存桶版本控制中開啟了 MFADelete 選項,則如果存取憑證是使用 MFA 簽署的,則不需要 "x-amz-mfa"(另請參閱 MFA(多因素驗證)刪除)。
如果啟用了儲存桶日誌,刪除多個物件將為每個被刪除的物件建立一個單獨的日誌條目。
取得物件回應標頭
在 GET 物件請求中,任何以 "response-" 開頭的標頭都將作為回應標頭返回(減去字串 "response-")。
物件伺服器端加密
myQNAPcloud Object 加密所有靜態存儲的數據,無論請求的加密為何。系統將使用任何呼叫者提供的加密密鑰,或者如果沒有提供客戶密鑰,則為每個物件生成一個隨機的密鑰加密密鑰。如果客戶提供了加密密鑰,類似於 AWS S3,myQNAPcloud Object 不會在元數據中保留客戶密鑰的副本,呼叫者必須提供加密密鑰以讀取數據。如果 myQNAPcloud Object 提供加密密鑰,則呼叫者不需要採取任何行動。
呼叫者可以使用標頭 x-amz-server-side-encryption-customer-algorithm、x-amz-server-side-encryption-customer-key 和 x-amz-server-side-encryption-customer-key-MD5 提供加密金鑰。這些引數的工作方式與 AWS S3 相同。
myQNAPcloud Object 不支援密鑰管理服務。因此,不支援 "x-amz-server-side-encryption" 以及所有 "aws:kms" 功能。 myQNAPcloud Object 儲存一個 MD5 用於數據,無論伺服器端加密如何,這始終是上傳的數據。
物件儲存空間類別
myQNAPcloud Object 僅提供一個儲存空間類別,這最像標準的 AWS S3 儲存空間類別。在任何操作中返回儲存空間類別時,myQNAPcloud Object 將返回標準的 AWS S3 儲存空間類別。
myQNAPcloud Object 中不支援的物件操作
|
| 物件 RESTORE | myQNAPcloud Object 不支援多個儲存空間類別,也不支援用於從不同儲存空間類別中恢復物件的 POST 物件 RESTORE 請求。 |
| 選擇物件內容 | myQNAPcloud Object 不支援根據簡單結構化查詢語言(SQL)語句過濾 Amazon S3 物件內容的操作。 |
| S3 批次操作 | myQNAPcloud Object 不支援物件管理的 S3 批次操作。 |
符合 myQNAPcloud Object S3 API
在符合規範的儲存桶中,任何物件的合規設定也可以在儲存桶的合規限制內進行更改。使用以下 XML 標籤指定物件的合規設定。
|
| LegalHold | 一個布林值「true」或「false」來設定法律保留狀態。當物件的法律保留狀態為 true 時,無論保留期如何,該物件都無法被刪除。 |
| RetentionTime | 一個 ISO 時間,為物件設定新的保留時間,在此時間之前該物件無法被刪除。請注意,新的保留時間必須超過儲存桶政策給定的保留期,否則會返回錯誤。 |
以下是設定物件合規的範例:
PUT http://s3.us-east-1.myqnapcloud.io/my-bucket/my-object?complianceHTTP/1.1 <objectcomplianceconfiguration> <conditionalhold>false</conditionalhold> <retentiontime>2018-03-13T10:45:00Z</retentiontime> </objectcomplianceconfiguration>
可以使用「?compliance」查詢字串檢索任何特定物件的合規設定。除了上述的物件合規設定外,查詢還會返回物件的計算 SHA256 雜湊值,可用於確定物件未被修改。請注意,SHA256 值僅適用於作為單一物件上傳的物件,不適用於多部分或合成物件。
以下是獲取物件合規的範例:
GET http://s3.us-east-1.myqnapcloud.io/my-bucket/my-object?complianceHTTP/1.1
回應主體:
<objectcomplianceconfiguration xml ns="http://s3.amazonaws.com/doc/2006-03-01/"> <retentiontime>2016-10-31T15:08:05Z</retentiontime> <conditionalhold>false</conditionalhold> <legalhold>false</legalhold> <sha256>14b4be3894e92166b508007b6c2e4fb6e88d3d0ad652c76475089a50ebe6e33b</sha256> </objectcomplianceconfiguration>
當儲存桶啟用合規時,物件的合規設定也會出現在儲存桶列表中。
物件鎖定與 myQNAPcloud Object S3 API
您可以使用下述標籤為物件新增或更新物件鎖定設定。
|
| RetainUntilDate | 這定義了物件的保留時間。在此時間之前,物件不能被刪除。請注意,保留時間必須是未來的時間。 |
| 法律保護 | 這應該是 ON 或 OFF,不區分大小寫。 |
以下是設定物件鎖定配置的範例:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/beta_vpn.png?retention&versionId= 001617181245457483475-4ylsTbqqvP <retention> <mode>compliance</mode> <retainuntildate>2021-04-06T09:00:45Z</retainuntildate> </retention>
以下是設定物件法律保護的範例:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/beta_vpn.png?legal-hold&versionId=001617181245457483475-4ylsTbqqvP <legalhold> <status>ON</status> </legalhold>
以下是設定物件治理模式的範例:
PUT https://s3.us-east-1.myqnapcloud.io/qa.objectlock.002/public/ACL.PNG?retention <retention> <mode>governance</mode> <retainuntildate>2021-05-20T09:00:45Z</retainuntildate> </retention>
每當您想要覆蓋物件的治理設定時,必須包含“x-amz-bypass-governance-retention =true”標頭。
myQNAPcloud Object 儲存空間區域的服務 URL
myQNAPcloud Object 不同儲存空間區域的 myQNAPcloud 服務 URL 如下:
美洲
| 區域 | 服務 URL |
|---|
| 美國東部 1(弗吉尼亞北部) | s3 .us-east-1.myqnapcloud.io |
| 美國中部 1(德克薩斯州) | s3.us-central-1. myqnapcloud.io |
| 美國西部 1(俄勒岡州) | s3.us-west-1. myqnapcloud.io |
| 加拿大中部 1(多倫多) | s3.ca-central-1. myqnapcloud.io |
歐洲、中東和非洲
| 歐洲中部 1(阿姆斯特丹) | s3.eu-central-1. myqnapcloud.io |
| 歐洲中部 2(法蘭克福) | s3.eu-central-2. myqnapcloud.io |
| 歐洲西部 1 (倫敦) | s3.eu-west-1. myqnapcloud.io |
| 歐洲西部 2 (巴黎) | s3.eu-west-2. myqnapcloud.io |
| 歐洲西部 3 (倫敦) | s3.eu-west-3. myqnapcloud.io |
| 歐洲南部 1 (米蘭) | s3.eu-south-1. myqnapcloud.io |
亞太地區
| 亞太東北 1 (東京) | s3.ap-northeast-1. myqnapcloud.io |
| 亞太東北 2 (大阪) | s3.ap-northeast-2. myqnapcloud.io |
| 亞太東南 1 (新加坡) | s3.ap-southeast-1. myqnapcloud.io |
| 亞太東南 2 (雪梨) | s3.ap-southeast-2. myqnapcloud.io |
可以透過 myQNAPcloud 入口網站訪問 myQNAPcloud Object 管理控制台。
如果您正在尋找正確的服務 URL 以搭配您的第三方儲存空間應用程式使用,您應選擇與您的儲存桶位置相符的 URL。
在使用第三方儲存空間應用程式時,您應該注意這些應用程式有不同的方法來處理儲存空間區域服務 URL。這些方法包括:
- 允許您明確輸入服務 URL 的應用程式。這些應用程式最具彈性,因為您可以輕鬆配置新的服務 URL。
- 僅允許您從預設的儲存空間區域列表中選擇的應用程式。這些應用程式的彈性最低,因為如果儲存空間提供商實施了新的區域,您必須等待應用程式更新才能訪問新區域。如果您的儲存空間應用程式不支援其預定義區域列表中的所有 myQNAPcloud Object 儲存空間區域,請聯繫應用程式供應商(而非 QNAP)以要求支援。
- 僅允許您輸入 API 金鑰集,然後提供您帳戶中所有貯體的應用程式。這些應用程式提供彈性,但需要一些自動重定向以在 HTTP 層級執行。
使用 myQNAPcloud Object S3 API 進行物件複製
取得物件標籤
myQNAPcloud Object 支援在物件符合以下條件時擷取其標籤集的功能:
當物件沒有任何標籤時
GET https://s3.myqnapcloud.io/my_bucket/Test-object1.txt?tagging
回應主體:
<?xml version="1.0" encoding="UTF-8"?> <tagging> <tagset></tagset> </tagging>
狀態 200 OK
當物件有標籤時
GET https://s3.myqnapcloud.io/my_bucket/Test-object2.pdf?tagging
回應主體:
<!--?xml version="1.0" encoding="UTF-8"?--> <tagging> <tagset> <tag> <key>key2</key> <value>value2</value> </tag> <tag> <key>key1</key> <value>value1</value> </tag> </tagset> </tagging>
設定物件標籤
myQNAPcloud Object 支援以下功能:
- 新增現有物件在儲存桶中的標籤值
- 附加現有物件在儲存桶中的標籤值
新增現有物件在儲存桶中的標籤值
PUT https://s3.myqnapcloud.io/my_bucket/Test-object3.pdf?tagging
Content-Type: text/xml
回應主體:
<tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <tagset> <tag> <key>tag1</key> <value>value1</value> </tag> </tagset> </tagging>
附加現有物件在儲存桶中的標籤值
在此範例中,現有物件已經有標籤值“key5”–“value5”,您可以在現有的標籤對中附加新的標籤對。
PUT https://s3.myqnapcloud.io/my_bucket/Test-object4.jpg?tagging
Content-Type: text/xml
回應主體:
<tagging xmlns="http://s3.myqnapcloud.io/doc/2006-03-01/"> <tagset> <tag> <key>key5</key> <value>value5</value> </tag> <tag> <key>key6</key> <value>value6</value> </tag> </tagset> </tagging>
狀態 200 OK
要 PUT 其他版本的標籤,請使用 versionId 查詢引數。
刪除物件標籤
這會從指定物件中移除整個標籤集。
DELETE https://s3.myqnapcloud.io/my_bucket/Test-object5.pdf?tagging
回應主體:
<empty>
狀態 204 No Content
要刪除其他版本的標籤,請使用 versionId 查詢引數。
使用 myQNAPcloud Object API 的物件標籤
取得物件標籤
myQNAPcloud Object 支援擷取物件標籤集的功能,當物件:
當物件沒有任何標籤時
GET
https://s3.myqnapcloud.io/my_bucket/Test-object1.txt?tagging
回應主體:
<?xml version="1.0" encoding="UTF-8"?> <tagging> <tagset></tagset> </tagging>
狀態 200 OK
當物件有標籤時
GET
https://s3.myqnapcloud.io/my_bucket/Test-object2.pdf?tagging
回應主體:
<!--?xml version="1.0" encoding="UTF-8"?--> <tagging> <tagset> <tag> <key>key2</key> <value>value2</value> </tag> <tag> <key>key1</key> <value>value1</value> </tag> </tagset> </tagging>
PUT 物件標籤
myQNAPcloud Object 支援以下功能:
- 新增儲存桶中現有物件的標籤值
- 附加儲存桶中現有物件的標籤值
新增儲存桶中現有物件的標籤值
PUT
https://s3.myqnapcloud.io/my_bucket/Test-object3.pdf?tagging
Content-Type: text/xml
回應主體:
<tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <tagset> <tag> <key>tag1</key> <value>value1</value> </tag> </tagset> </tagging>
附加儲存桶中現有物件的標籤值
在此範例中,現有物件已經有標籤值「key5」–「value5」,您可以在現有標籤對中附加新的標籤對。
PUT
https://s3.myqnapcloud.io/my_bucket/Test-object4.jpg?tagging
Content-Type: text/xml
回應內容:
<tagging xmlns="http://s3.myqnapcloud.io/doc/2006-03-01/"> <tagset> <tag> <key>key5</key> <value>value5</value> </tag> <tag> <key>key6</key> <value>value6</value> </tag> </tagset> </tagging>
狀態 200 OK
若要 PUT 其他版本的標籤,請使用 versionId 查詢引數。
刪除物件標籤
這將從指定的物件中移除整個標籤集。
DELETE
https://s3.myqnapcloud.io/my_bucket/Test-object5.pdf?tagging
回應內容:
<empty>
狀態 204 No Content
若要刪除其他版本的標籤,請使用 versionId 查詢引數。
進一步閱讀
由於其與 AWS S3 的相容性,AWS 官方的 S3 文件可作為使用 myQNAPcloud Object 時的補充資源。請參閱 Amazon Simple 儲存空間 Service API Reference 以了解 API 版本 2006-03-01 的詳細資訊:
Amazon Simple 儲存空間 Service API Reference