Object Storage Swift - Curl Command Memo (EN)
Objective
In this guide, you can find the main curl commands for managing your object containers.
Requirements
Load the following environment variables:
export OS_AUTH_URL=https://auth.cloud.ovh.net/v3/
export OS_STORAGE_URL=https://storage.<region>.cloud.ovh.net/v1/AUTH_702xxxxxxxxxxxxxxxxxxxxxxxxxxdaf
export OS_USERNAME=user-xxxxxx
export OS_PASSWORD=xxx
export OS_TENANT_ID=702xxxxxxxxxxxxxxxxxxxxxxxxxxdaf
export OS_AUTH_TOKEN=$(curl -is -X POST ${OS_AUTH_URL}auth/tokens -H "Content-Type: application/json" -d ' { "auth": { "identity": { "methods": ["password"], "password": { "user": { "name": "'$OS_USERNAME'", "domain": { "id": "default" }, "password": "'$OS_PASSWORD'" } } }, "scope": { "project": { "id": "'$OS_TENANT_ID'", "domain": { "id": "default" } } } } }' | grep -i '^x-subject-token' | cut -d" " -f2 | tr -d "\r")
Instructions
Create a PCS container
View account information
View container information
View object information
List the container(s) related to an account
List the contents of a container
Upload an object smaller than 5GB
Upload an object higher than 5GB in SLO mode
Create the manifest in json format based on the following attributes:
- path (Required)
eg:
pcs-test_segments/6gb.img_01 - etag (Optional)
Segment MD5 Checksum. This value is available in the segment's
Etagmetadata via:curl -i -X HEAD "$OS_STORAGE_URL/<container>/<object>" -H "X-Auth-Token:$OS_AUTH_TOKEN" - size_bytes (Optional)
Segment size. This value is available in the segment's
Content-Lengthmetadata via:curl -i -X HEAD "$OS_STORAGE_URL/<container>/<object>" -H "X-Auth-Token:$OS_AUTH_TOKEN"
Here is an example manifest:
Upload an object higher than 5GB in DLO mode
Download an object
Delete an empty container
Delete a non-empty container with fewer than 10000 objects
If the container contains LargeObjects, the
<container_segments>container must be manually deleted.
Empty a container with more than 10,000 objects
If the container contains LargeObject, the
<container_segments>container must be manually deleted.
Delete an object
Delete an object larger than 5Gb
Without the
?multipart-manifest=deleteargument, this will only delete the manifest file without the segments.
Add a metadata to a container
Add metadata to an object
Delete a metadata from a container
Delete a metadata from an object
Set Read ACL on a container
Set write ACL on a container
Delete the read ACL on a container
Delete write ACL on a container
Go further
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.
Join our community of users.