Alibaba Cloud OSS (Object Storage Service) client implementation for the unified storage-cli tool. This module provides Alibaba Cloud OSS operations through the main storage-cli binary.
Note: This is not a standalone CLI. Use the main storage-cli binary with -s alioss flag to access AliOSS functionality.
For general usage and build instructions, see the main README.
The AliOSS client requires a JSON configuration file with the following structure:
{
"access_key_id": "<string> (required)",
"access_key_secret": "<string> (required)",
"endpoint": "<string> (required)",
"bucket_name": "<string> (required)"
}Usage examples:
# Upload a blob
storage-cli -s alioss -c alioss-config.json put local-file.txt remote-blob
# Fetch a blob (destination file will be overwritten if exists)
storage-cli -s alioss -c alioss-config.json get remote-blob local-file.txt
# Delete a blob
storage-cli -s alioss -c alioss-config.json delete remote-blob
# Check if blob exists
storage-cli -s alioss -c alioss-config.json exists remote-blob
# Generate a signed URL (e.g., GET for 3600 seconds)
storage-cli -s alioss -c alioss-config.json sign remote-blob get 3600s# Uploading a blob:
curl -X PUT -T path/to/file <signed-url>
# Downloading a blob:
curl -X GET <signed-url>Run from the repository root directory:
ginkgo --skip-package=integration --cover -v -r ./alioss/...- To run the integration tests with your existing bucket:
- Export the following variables into your environment:
export ACCESS_KEY_ID=<your Alibaba access key id> export ACCESS_KEY_SECRET=<your Alibaba access key secret> export ENDPOINT=<your Alibaba OSS endpoint> export BUCKET_NAME=<your Alibaba OSS bucket>
- Navigate to project's root folder and run the command below:
go build -o ./alioss ./alioss && go test ./alioss/integration/...
- Export the following variables into your environment:
- To run it from scratch; create a new bucket, run tests, delete the bucket
- Create a user in your ali account and add policy
AliyunOSSFullAccess, or restrict the users with more granular policies likeoss:CreateBucket,oss:DeleteBucketetc. - Create access key for the user.
- Export
AccessKeyIdwith commandexport access_key_id=<AccessKeyId>. - Export
AccessKeySecretwith commandexport access_key_secret=<AccessKeySecret>. - Navigate to project's root folder.
- Run environment setup script to create bucket
./.github/scripts/alioss/setup.sh. - Run tests
./.github/scripts/alioss/run-int.sh. - Run environment teardown script to delete test resources
./.github/scripts/alioss/teardown.sh.
- Create a user in your ali account and add policy