Upload with Python-Swiftclient

With Python-Swiftclient you can manage your CDN storage containers.


You can list all containers in your account, list all objects in a container, fetch information about your account, upload, download, delete resources, etc.

swift COMMAND --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ YOUR_CONTAINER PATH_TO_YOUR_FILE


For information about installing and using the python-swiftclient tool please click here


Where

--os-username

Is the first part is your Openstack Swift username (–os-username) and the second part is your Openstack Swift tenant-name (–os-tenant-name) (e.g 1011131.1011131). 

Due to the requirements of the Object Storage service (swift) architecture, your FTP username contains two authentication parts separated by dot (.) character. 

In the provided example the Openstack Swift username (–os-username) is 1011131


--os-tenant-name

Is the second part of your FTP username is (–os-tenant-name). 

In the provided example the Openstack Swift tenant-name (–os-tenant-name) is 1011131


--os-password 

Is the FTP password, which can be obtained through the Universal CDN Control Panel. 


--os-auth-url 

Is the Swift authorization URL. 

Below are the authorization URLs that should be used: 

https://auth.files.nl01.cloud.servers.com:5000/v2.0/ – to connect to your Europe container. 

https://auth.files.us01.cloud.servers.com:5000/v2.0/ – to connect to your North American container.


Let’s review the following examples:
 


Using the command stat for fetching account information.

swift stat --verbose --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url

Example: 

swift stat --verbose --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/


Using the command list for listing the containers for the account or the objects for a container.

swift list --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url 

Example: 

Listing storage containers:

swift list --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/

Listing objects for a container:

swift list --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ YOUR_CONTAINER_NAME


Using the command upload
for uploading specified files and directories to the given container.

swift upload --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ YOUR_CONTAINER PATH_TO_YOUR_FILE

Example: 

swift upload --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ test /example/example.mp4


Uploading large files 

To upload files larger than 5GB, you can use segmentation. It allows you to split them into smaller segments. For example, if the size of a file is 6GB, you can split it into two segments of 3GB.

Example:

swift upload --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ test -S 3221225472 /example/example.mp4

IMPORTANT! Use -S option to specify the segment size in bytes to use when splitting a large file (e.g. 1 Gigabyte = 1073741824 Bytes, 3 Gigabytes = 3221225472 Bytes) 

The above command will upload the “large_file” in segments of 3GB. 


Using the command
download for downloading objects from containers.

swift download --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ YOUR_CONTAINER PATH_TO_YOUR_FILE

Example:

swift download --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ test example.mp4


Using the command
delete for deleting objects within a container.

swift delete --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ YOUR_CONTAINER PATH_TO_YOUR_FILE

Example: 

swift delete --os-username 1011131 --os-tenant-name 1011131 --os-password fQFImBsSeaJjicts --os-auth-url https://auth.files.nl01.cloud.servers.com:5000/v2.0/ test example.mp4

For additional information on the Python-Swiftclien commands read the swift – Man page or read the Documentation at https://www.swiftstack.com/docs/integration/python-swiftclient.html#accessing-your-cluster-from-the-command-line


IMPORTANT! 
Please note that the storage containers must be created only from the Universal CDN Control Panel. Storage containers created not from the Control Panel will be rejected by the CDN system.



FTP Upload

Upload Large Files with Python-Swiftclient

Upload Through OpenStack Swift API

Upload with Rclone