read-symlink (read symbolic links)
The read-symlink command reads information about a symbolic link, such as its ETag value and last modified time. This operation requires read permissions for the symbolic link.
Usage notes
-
To read a symbolic link, you must have the oss:GetObject permission. For more information, see Grant custom policies to a RAM user.
-
For ossutil 1.6.16 and later, you can use ossutil as the binary name in the command line. You do not need to update the binary name based on the operating system. For versions of ossutil earlier than 1.6.16, you must update the binary name based on the operating system. For more information, see ossutil command reference.
-
Take note of the following items when you run the command in OSS on CloudBox:
Replace the endpoints in the configuration file with the endpoints of CloudBox. For more information, see CloudBox endpoints.
Add --sign-version, --region, and --cloudbox-id options to the sample command in this topic. For more information about the options, see Common options.
-
For more information about symbolic links, see Symbolic links.
Command syntax
ossutil read-symlink oss://bucketname/objectname [--encoding-type <value>] [--payer <value>]
The following table describes the parameters and options.
|
Parameter |
Description |
|
bucketname |
The name of the bucket. |
|
objectname |
The name of the symbolic link. |
|
--encoding-type |
The encoding method for the name of the symbolic link. Set the value to url. If you do not specify this option, the name is not encoded. |
|
--payer |
The payment method for the request. If you want the requester who accesses the resources in the specified path to pay for the fees, such as traffic and requests, set the value of this option to requester. |
Examples
The following example shows how to read information about the symbolic link named test.jpg in the examplebucket bucket.
ossutil read-symlink oss://examplebucket/test.jpg
The following output shows the ETag value, last modified time (Last-Modified), and the target file (X-Oss-Symlink-Target) of the symbolic link test.jpg. The target file is example.jpg.
Etag : 938F26218CE422CBEEE0B6543A2B2D
Last-Modified : 2021-04-21 18:00:13 +0800 CST
X-Oss-Symlink-Target : example.jpg
0.217317(s) elapsed
If you run this command on an object that is not a symbolic link, the NotSymlink error is returned.
Common options
To access a bucket in a different region, use -e to specify the endpoint. To access a bucket owned by a different Alibaba Cloud account, use -i for the AccessKey ID and -k for the AccessKey secret.
For example, run the following command to read information about the symbolic link named testobject.png in the testbucket bucket. The bucket is in the China (Shanghai) region and owned by another Alibaba Cloud account.
ossutil read-symlink oss://testbucket/testobject.png -e oss-cn-shanghai.aliyuncs.com -i yourAccessKeyID -k yourAccessKeySecret