Setting Object Properties
Function
You can use this command to set properties of an object or set properties of objects in batches by a specified object name prefix.
![](https://support.huaweicloud.com/intl/en-us/ae-ad-1-utiltg-obs/public_sys-resources/note_3.0-en-us.png)
You can set storage classes only for buckets whose version is 3.0.
Command Line Structure
- In Windows
- Setting properties of a single object
obsutil chattri obs://bucket/key [-sc=xxx] [-acl=xxx] [-aclXml=xxx] [-versionId=xxx] [-fr] [-o=xxx] [-config=xxx]
- Setting properties of objects in batches
obsutil chattri obs://bucket[/key] -r [-f] [-v] [-sc=xxx] [-acl=xxx] [-aclXml=xxx] [-o=xxx] [-j=1] [-config=xxx]
- Setting properties of a single object
- In Linux or macOS
- Setting properties of a single object
./obsutil chattri obs://bucket/key [-sc=xxx] [-acl=xxx] [-aclXml=xxx] [-versionId=xxx] [-fr] [-o=xxx] [-config=xxx]
- Setting properties of objects in batches
./obsutil chattri obs://bucket[/key] -r [-f] [-v] [-sc=xxx] [-acl=xxx] [-aclXml=xxx] [-o=xxx] [-j=1] [-config=xxx]
- Setting properties of a single object
Examples
- Take the Windows OS as an example, run the obsutil chattri obs://bucket-test/key -acl=public-read command to set the access permission to an object to public read.
obsutil chattri obs://bucket-test/key -acl=public-read Set the acl of object [key] in the bucket [bucket-test] to [public-read] successfully, request id [04050000016836DDFA73B2B5320E2651]
- Take the Windows OS as an example, run the obsutil chattri obs://bucket-test -r -f -acl=public-read command to set the access permission to all objects in the bucket to public read.
obsutil chattri obs://bucket-test -r -f -acl=public-read [------------------------------------------------] 100.00% tps:155.15 5/5 233ms Succeed count is: 5 Failed count is: 0 Metrics [max cost:177 ms, min cost:53 ms, average cost:102.40 ms, average tps:20.41] Task id is: 9d7f73ff-f747-4fdd-9b2a-815ba2dc3b07
Parameter Description
Parameter |
Optional or Mandatory |
Description |
---|---|---|
bucket |
Mandatory |
Bucket name |
key |
Mandatory for setting properties of an object. Optional for setting properties of objects in batches. |
Indicates the name of the object whose properties are to be set, or the name prefix of objects whose properties are to be set in batches.
NOTE:
If this parameter is left blank during batch operation, properties of all objects in the bucket are set. |
sc |
Optional (additional parameter) |
Storage classes of objects. Possible values are:
NOTE:
For an object whose storage class is cold, restore the object first and then set its storage class. To restore an object, see Restoring Objects from. |
acl |
Optional (additional parameter) |
Access control policies that can be specified for objects. Possible values are:
NOTE:
The preceding four values indicate private read and write, public read, public read and write, and bucket owner full control. |
aclXml |
Optional (additional parameter) |
Access control policy of the bucket, in XML format. <AccessControlPolicy> <Owner> <ID>ownerid</ID> </Owner> <AccessControlList> <Grant> <Grantee> <ID>userid</ID> </Grantee> <Permission>[WRITE|WRITE_ACP|READ|READ_ACP|FULL_CONTROL]</Permission> </Grant> <Grant> <Grantee> <Canned>Everyone</Canned> </Grantee> <Permission>[WRITE|WRITE_ACP|READ|READ_ACP|FULL_CONTROL]</Permission> </Grant> </AccessControlList> </AccessControlPolicy>
NOTE:
NOTICE:
Because angle brackets (<) and (>) are unavoidably included in the parameter value, you must use quotation marks to enclose them for escaping when running the command. Use single quotation marks for Linux or macOS and quotation marks for Windows. |
versionId |
Optional for setting properties of an object (additional parameter) |
Version ID of the object whose properties are to be set |
fr |
Optional for setting properties of an object (additional parameter) |
Generates an operation result list when setting properties of an object. |
f |
Optional when setting properties of objects in batches (additional parameter) |
Runs in force mode. |
r |
Mandatory when setting properties of objects in batches (additional parameter) |
Sets properties of objects in batches based on a specified object name prefix. |
v |
Optional when setting properties of objects in batches (additional parameter) |
Sets properties of versions of objects in batches based on a specified object name prefix. |
o |
Optional (additional parameter) |
Indicates the folder where operation result lists reside. After the command is executed, result lists (including success and failure files) are generated in the folder. The default value is .obsutil_output, the subfolder in the home directory of the user who executes obsutil commands.
NOTE:
|
j |
Optional when setting properties of objects in batches (additional parameter) |
Indicates the maximum number of concurrent tasks for setting object properties in batches. The default value is the value of defaultJobs in the configuration file.
NOTE:
The value is ensured to be greater than or equal to 1. |
config |
Optional (additional parameter) |
User-defined configuration file for executing a command. For details about parameters that can be configured, see Parameter Description. |
![](https://support.huaweicloud.com/intl/en-us/ae-ad-1-utiltg-obs/public_sys-resources/note_3.0-en-us.png)
Only one from acl, sc, or aclXml can be set for each command.
Response
Refer to Response for uploading an object.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot