Merge pull request #44585 from rallytime/followup-44416

Update new boto_kinesis.list_streams function
This commit is contained in:
Mike Place 2017-11-18 18:42:36 +01:00 committed by GitHub
commit 601b94644c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -445,21 +445,23 @@ def list_streams(region=None, key=None, keyid=None, profile=None):
'''
Return a list of all streams visible to the current account
CLI example::
CLI example:
.. code-block:: bash
salt myminion boto_kinesis.list_streams
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
streams = []
ExclusiveStartStreamName = ''
while ExclusiveStartStreamName is not None:
args = {'ExclusiveStartStreamName': ExclusiveStartStreamName} if ExclusiveStartStreamName else {}
r = _execute_with_retries(conn, 'list_streams', **args)
if 'error' in r:
return r
r = r['result'] if r and r.get('result') else {}
streams += r.get('StreamNames', [])
ExclusiveStartStreamName = streams[-1] if r.get('HasMoreStreams', False) in (True, 'true') else None
exclusive_start_stream_name = ''
while exclusive_start_stream_name is not None:
args = {'ExclusiveStartStreamName': exclusive_start_stream_name} if exclusive_start_stream_name else {}
ret = _execute_with_retries(conn, 'list_streams', **args)
if 'error' in ret:
return ret
ret = ret['result'] if ret and ret.get('result') else {}
streams += ret.get('StreamNames', [])
exclusive_start_stream_name = streams[-1] if ret.get('HasMoreStreams', False) in (True, 'true') else None
return {'result': streams}