Skip to content

Commit 6fb1e64

Browse files
Merge pull request #1411 from FernandoOjeda/ft/object_storage_pagination
Add pagination to object storage list accounts.
2 parents bc500bb + 09f3ce5 commit 6fb1e64

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

SoftLayer/CLI/object_storage/list_accounts.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99

1010

1111
@click.command()
12+
@click.option('--limit',
13+
type=int,
14+
default=10,
15+
help="Result limit")
1216
@environment.pass_env
13-
def cli(env):
17+
def cli(env, limit):
1418
"""List object storage accounts."""
1519

1620
mgr = SoftLayer.ObjectStorageManager(env.client)
17-
accounts = mgr.list_accounts()
21+
accounts = mgr.list_accounts(limit=limit)
1822
table = formatting.Table(['id', 'name', 'apiType'])
1923
table.sortby = 'id'
2024
api_type = None

SoftLayer/managers/object_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class ObjectStorageManager(object):
2727
def __init__(self, client):
2828
self.client = client
2929

30-
def list_accounts(self):
30+
def list_accounts(self, limit=10):
3131
"""Lists your object storage accounts."""
3232
return self.client.call('Account', 'getHubNetworkStorage',
33-
mask=LIST_ACCOUNTS_MASK)
33+
mask=LIST_ACCOUNTS_MASK, iter=True, limit=limit)
3434

3535
def list_endpoints(self):
3636
"""Lists the known object storage endpoints."""

0 commit comments

Comments
 (0)