The swift client is the command-line interface (CLI) for the Object Storage service API and its extensions.
This chapter documents swift version 3.3.0
.
For help on a specific swift command, enter:
$ swift COMMAND --help
Usage: swift [--version] [--help] [--os-help] [--snet] [--verbose]
[--debug] [--info] [--quiet] [--auth <auth_url>]
[--auth-version <auth_version> |
--os-identity-api-version <auth_version> ]
[--user <username>]
[--key <api_key>] [--retries <num_retries>]
[--os-username <auth-user-name>] [--os-password <auth-password>]
[--os-user-id <auth-user-id>]
[--os-user-domain-id <auth-user-domain-id>]
[--os-user-domain-name <auth-user-domain-name>]
[--os-tenant-id <auth-tenant-id>]
[--os-tenant-name <auth-tenant-name>]
[--os-project-id <auth-project-id>]
[--os-project-name <auth-project-name>]
[--os-project-domain-id <auth-project-domain-id>]
[--os-project-domain-name <auth-project-domain-name>]
[--os-auth-url <auth-url>] [--os-auth-token <auth-token>]
[--os-storage-url <storage-url>] [--os-region-name <region-name>]
[--os-service-type <service-type>]
[--os-endpoint-type <endpoint-type>]
[--os-cacert <ca-certificate>] [--insecure]
[--os-cert <client-certificate-file>]
[--os-key <client-certificate-key-file>]
[--no-ssl-compression]
<subcommand> [--help] [<subcommand options>]
Subcommands:
delete
download
list
post
copy
stat
upload
capabilities
tempurl
auth
swift download --help
swift -A https://auth.api.rackspacecloud.com/v1.0 -U user -K api_key stat -v
swift --os-auth-url https://api.example.com/v2.0 \
--os-tenant-name tenant --os-username user --os-password password list
swift --os-auth-url https://api.example.com/v3 --auth-version 3 \
--os-project-name project1 --os-project-domain-name domain1 \
--os-username user --os-user-domain-name domain1 \
--os-password password list
swift --os-auth-url https://api.example.com/v3 --auth-version 3 \
--os-project-id 0123456789abcdef0123456789abcdef \
--os-user-id abcdef0123456789abcdef0123456789 \
--os-password password list
swift --os-auth-token 6ee5eb33efad4e45ab46806eac010566 \
--os-storage-url https://10.1.5.2:8080/v1/AUTH_ced809b6a4baea7aeab61a \
list
swift list --lh
--version
-h, --help
--os-help
-s, --snet
-v, --verbose
--debug
--info
-q, --quiet
-A AUTH, --auth=AUTH
-V AUTH_VERSION, --auth-version=AUTH_VERSION, --os-identity-api-version=AUTH_VERSION
env[ST_AUTH_VERSION]
, env[OS_AUTH_VERSION]
,
env[OS_IDENTITY_API_VERSION]
or 1.0.-U USER, --user=USER
-K KEY, --key=KEY
-R RETRIES, --retries=RETRIES
--insecure
env[SWIFTCLIENT_INSECURE]
(set to 'true' to enable).--no-ssl-compression
Usage: swift auth
Display auth related authentication variables in shell friendly format.
Commands to run to export storage url and auth token into
OS_STORAGE_URL
and OS_AUTH_TOKEN
:
$ swift auth
Commands to append to a runcom file (e.g. ~/.bashrc, /etc/profile) for automatic authentication:
$ swift auth -v -U test:tester -K testing -A http://localhost:8080/auth/v1.0
Usage: swift capabilities [--json] [<proxy_url>]
Retrieve capability of the proxy.
Optional positional arguments:
<proxy_url>
--json
Usage: swift copy [--destination </container/object>] [--fresh-metadata]
[--meta <name:value>] [--header <header>] <container>
<object> [<object>] [...]
Copies object to new destination, optionally updates objects metadata. If destination is not set, will update metadata of object
Positional arguments:
<container>
<object>
Optional arguments:
-d, --destination </container[/object]>
-M, --fresh-metadata
-m, --meta <name:value>
Sets a meta data item. This option may be repeated.
Example: -m Color:Blue -m Size:Large
-H, --header <header:value>
Adds a customized request header. This option may be repeated.
Example: -H "content-type:text/plain" -H "Content-Length: 4000"
Usage: swift delete [--all] [--leave-segments]
[--object-threads <threads>]
[--container-threads <threads>]
[--header <header:value>]
[<container> [<object>] [...]]
Delete a container or objects within a container.
Positional arguments:
[<container>]
[<object>]
Optional arguments:
-a, --all
--leave-segments
-H, --header <header:value>
--object-threads <threads>
--container-threads <threads>
Usage: swift download [--all] [--marker <marker>] [--prefix <prefix>]
[--output <out_file>] [--output-dir <out_directory>]
[--object-threads <threads>] [--ignore-checksum]
[--container-threads <threads>] [--no-download]
[--skip-identical] [--remove-prefix]
[--header <header:value>] [--no-shuffle]
[<container> [<object>] [...]]
Download objects from containers.
Positional arguments:
<container>
<object>
Optional arguments:
-a, --all
-m, --marker <marker>
-p, --prefix <prefix>
-r, --remove-prefix
-o, --output <out_file>
-D, --output-dir <out_directory>
--object-threads <threads>
--container-threads <threads>
--no-download
-H, --header <header:value>
Adds a customized request header to the query, like "Range" or "If-Match". This option may be repeated.
Example: --header "content-type:text/plain"
--skip-identical
--ignore-checksum
--no-shuffle
Usage: swift list [--long] [--lh] [--totals] [--prefix <prefix>]
[--delimiter <delimiter>] [--header <header:value>]
[<container>]
Lists the containers for the account or the objects for a container.
Positional arguments:
[container]
Optional arguments:
-l, --long
--lh
-t, --totals
-p <prefix>, --prefix <prefix>
-d <delim>, --delimiter <delim>
-H, --header <header:value>
Usage: swift post [--read-acl <acl>] [--write-acl <acl>] [--sync-to]
[--sync-key <sync-key>] [--meta <name:value>]
[--header <header>]
[<container> [<object>]]
Updates meta information for the account, container, or object. If the container is not found, it will be created automatically.
Positional arguments:
[container]
[object]
Optional arguments:
-r, --read-acl <acl>
.r:*
, .r:-.example.com
, .r:www.example.com
,
account1
(v1.0 identity API only),
account1:*
, account2:user2
(v2.0+ identity API).-w, --write-acl <acl>
account1
(v1.0 identity API only),
account1:*
, account2:user2
(v2.0+ identity API).-t, --sync-to <sync-to>
-k, --sync-key <sync-key>
-m, --meta <name:value>
Sets a meta data item. This option may be repeated.
Example: -m Color:Blue -m Size:Large
-H, --header <header:value>
Adds a customized request header. This option may be repeated.
Example: -H "content-type:text/plain" -H "Content-Length: 4000"
Usage: swift stat [--lh] [--header <header:value>]
[<container> [<object>]]
Displays information for the account, container, or object.
Positional arguments:
[container]
[object]
Optional arguments:
--lh
-H, --header <header:value>
Usage: swift tempurl [--absolute] [--prefix-based]
<method> <seconds> <path> <key>
Generates a temporary URL for a Swift object.
Positional arguments:
<method>
<seconds>
<path>
The full path to the Swift object.
Example: /v1/AUTH_account/c/o or: http://saio:8080/v1/AUTH_account/c/o
<key>
Optional arguments:
--absolute
--prefix-based
Usage: swift upload [--changed] [--skip-identical] [--segment-size <size>]
[--segment-container <container>] [--leave-segments]
[--object-threads <thread>] [--segment-threads <threads>]
[--header <header>] [--use-slo] [--ignore-checksum]
[--object-name <object-name>]
<container> <file_or_directory> [<file_or_directory>] [...]
Uploads specified files and directories to the given container.
Positional arguments:
<container>
<file_or_directory>
Optional arguments:
-c, --changed
--skip-identical
-S, --segment-size <size>
--segment-container <container>
--leave-segments
--object-threads <threads>
--segment-threads <threads>
-H, --header <header:value>
--use-slo
--object-name <object-name>
--ignore-checksum
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.