Skip to content

Commit 145b826

Browse files
authored
Merge pull request #37 from hpe-container-platform-community/hurrynair/implement-user-list-in-34
Added method to retrieve the list of users
2 parents 258dbc8 + e1543d5 commit 145b826

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

bin/cli.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
K8sClusterHostConfig,
2323
K8sClusterStatus,
2424
)
25+
from hpecp.user import (
26+
User
27+
)
2528
from hpecp import (
2629
ContainerPlatformClient,
2730
ContainerPlatformClientException,
@@ -821,6 +824,24 @@ def create(
821824
print("User already exists.")
822825
sys.exit(1)
823826

827+
def list(
828+
self, output = "table", columns = User.default_display_fields,
829+
):
830+
"""Retrieve the list of Users
831+
:param output: how to display the output [text|table|json]
832+
"""
833+
if output == "table":
834+
print(get_client().user.list().tabulate(columns=columns))
835+
elif output == "text":
836+
print(
837+
get_client()
838+
.user.list()
839+
.tabulate(
840+
columns=columns, style="plain", display_headers=False,
841+
)
842+
)
843+
else:
844+
print(get_client().user.list().json)
824845
# raise NotImplementedError
825846

826847

0 commit comments

Comments
 (0)