The symbolic link feature provides easy access to frequently used files in a bucket. After you create a symbolic link, you can use it to open a file, which is similar to using a shortcut in Windows. This topic describes how to use the OSS Swift SDK to create and retrieve symbolic links.
Precautions
The sample code in this topic uses the China (Hangzhou) region ID
cn-hangzhouas an example. The code uses a public endpoint by default. To access OSS from other Alibaba Cloud products in the same region, use an internal endpoint. For more information about the mappings between OSS-supported regions and endpoints, see Regions and endpoints.To create a symbolic link, you must have the
oss:PutObjectpermission. To retrieve a symbolic link, you must have theoss:GetObjectpermission. For more information, see Grant custom permissions to a RAM user.
Sample code
References
For the complete sample code for symbolic links, see the GitHub examples put_symlink and get_symlink.
For more information about operations on symbolic links, see Symbolic links.
For more information about the API operation to create a symbolic link, see PutSymlink.
For more information about the API operation to retrieve a symbolic link, see GetSymlink.