Skip to content

Using the Swift Client

With the Swift client (swift) you can easily interact with your Object Storage. Here you will find practical examples of how to use the client for your bucket at storage.netways.cloud.

Prerequisites

  • You have a subuser with a secret key.
  • The Swift client is installed on your system. If not, install it with:
pip install python-swiftclient

Configuring the Swift Client

1. Set environment variables

Create a file swiftrc.sh with the following content:

export ST_AUTH=https://storage.netways.cloud/auth/v1.0
export ST_USER=HAUPT_USER:SUBUSER
export ST_KEY=SECRET_KEY

Then activate it:

source swiftrc.sh

Alternatively, you can provide the credentials with each command (see examples below).


Basic Examples

1. List containers

swift list

Or without environment variables:

swift -A https://storage.netways.cloud/auth/v1.0 \
      -U HAUPTKONTO:SUBUSER \
      -K DEIN_SECRET_KEY \
      list

2. Upload a file

swift upload mein-container ~/meine-datei.txt

3. List container contents

swift list mein-container

4. Sync a directory

swift upload mein-container ~/mein-verzeichnis

5. Download a file

swift download mein-container meine-datei.txt --output ~/Downloads/meine-datei.txt

6. Delete a file

swift delete mein-container meine-datei.txt

7. Show file statistics

swift stat mein-container meine-datei.txt

8. Create a container

swift post mein-container2

Basic commands for container access rights

1. Show current ACL

swift stat mein-container

2. Allow public read access

swift post mein-container -r '.r:*,.rlistings'

URL

The container will then be publicly viewable at https://storage.netways.cloud/swift/v1/mein-container.

3. Remove public access

swift post mein-container -r ''

Warning

Public access allows anyone on the internet to access your objects. Use this only in exceptional cases!

Object Metadata

1. Set metadata for a container

swift post mein-container -m X-Container-Meta-Projekt:MeinProjekt

2. Show object metadata

swift stat mein-container meine-datei.txt

Tips & Hints

Security notes

  • Containers with public access (.r:*) should be checked regularly
  • Access is always container‑wide – not per object
  • Use metadata for structuring and categorizing objects
Debugging

Add the --debug parameter to your commands to get detailed information, e.g.:

```bash swift --debug list