diff options
author | Christopher Bartz <bartz@dkrz.de> | 2016-12-08 13:42:35 +0100 |
---|---|---|
committer | Christopher Bartz <bartz@dkrz.de> | 2017-01-19 16:34:26 +0100 |
commit | 3934bd606acc2333ee9ae63a40baa35928ef908d (patch) | |
tree | 1181d58436365ce6d9863866c112f78e6677a081 /swiftclient/shell.py | |
parent | aea0585ddbc749b6f4d501430d41b671932c11a4 (diff) | |
download | python-swiftclient-3934bd606acc2333ee9ae63a40baa35928ef908d.tar.gz |
prefix-based tempurls support
Implements client-side functionality for
prefix-based tempurls.
Please see: https://review.openstack.org/#/c/274048/
Change-Id: I8d7701daee888ed1120271a96c0660b01543ca2d
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-x | swiftclient/shell.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py index 9819bf3..6956a15 100755 --- a/swiftclient/shell.py +++ b/swiftclient/shell.py @@ -1222,9 +1222,8 @@ def st_auth(parser, args, thread_manager): print('export OS_AUTH_TOKEN=%s' % sh_quote(token)) -st_tempurl_options = '''[--absolute] - <method> <seconds> <path> <key> -''' +st_tempurl_options = '''[--absolute] [--prefix-based] + <method> <seconds> <path> <key>''' st_tempurl_help = ''' @@ -1247,6 +1246,7 @@ Optional arguments: --absolute Interpret the <seconds> positional argument as a Unix timestamp rather than a number of seconds in the future. + --prefix-based If present, a prefix-based tempURL will be generated. '''.strip('\n') @@ -1256,8 +1256,14 @@ def st_tempurl(parser, args, thread_manager): dest='absolute_expiry', default=False, help=("If present, seconds argument will be interpreted as a Unix " "timestamp representing when the tempURL should expire, rather " - "than an offset from the current time") + "than an offset from the current time"), ) + parser.add_argument( + '--prefix-based', action='store_true', + default=False, + help=("If present, a prefix-based tempURL will be generated."), + ) + (options, args) = parse_args(parser, args) args = args[1:] if len(args) < 4: @@ -1274,7 +1280,8 @@ def st_tempurl(parser, args, thread_manager): method.upper()) try: path = generate_temp_url(parsed.path, seconds, key, method, - absolute=options['absolute_expiry']) + absolute=options['absolute_expiry'], + prefix=options['prefix_based'],) except ValueError as err: thread_manager.error(err) return |