diff options
author | mmcardle <mark.mcardle@sohonet.com> | 2018-07-10 14:45:32 +0100 |
---|---|---|
committer | mmcardle <mark.mcardle@sohonet.com> | 2018-07-10 15:23:30 +0100 |
commit | 47fb18c41b4851ba6071f0215e96e222b8ccef29 (patch) | |
tree | 424c38feb86558a61beb6b502f9608b0cd5011fb /swiftclient/shell.py | |
parent | c2c5af603f8ae25be052a20b02dc109b0f8f014a (diff) | |
download | python-swiftclient-47fb18c41b4851ba6071f0215e96e222b8ccef29.tar.gz |
Add ability to generate a temporary URL with an
IP range restriction
Change-Id: I4734599886e4f4a563162390d0ff3bb1ef639db4
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-x | swiftclient/shell.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py index e91a16f..74a47b7 100755 --- a/swiftclient/shell.py +++ b/swiftclient/shell.py @@ -1325,6 +1325,8 @@ Optional arguments: generated. --iso8601 If present, the generated temporary URL will contain an ISO 8601 UTC timestamp instead of a Unix timestamp. + --ip-range If present, the temporary URL will be restricted to the + given ip or ip range. '''.strip('\n') @@ -1348,6 +1350,12 @@ def st_tempurl(parser, args, thread_manager): help=("If present, the temporary URL will contain an ISO 8601 UTC " "timestamp instead of a Unix timestamp."), ) + parser.add_argument( + '--ip-range', action='store', + default=None, + help=("If present, the temporary URL will be restricted to the " + "given ip or ip range."), + ) (options, args) = parse_args(parser, args) args = args[1:] @@ -1367,7 +1375,8 @@ def st_tempurl(parser, args, thread_manager): path = generate_temp_url(parsed.path, timestamp, key, method, absolute=options['absolute_expiry'], iso8601=options['iso8601'], - prefix=options['prefix_based']) + prefix=options['prefix_based'], + ip_range=options['ip_range']) except ValueError as err: thread_manager.error(err) return |