From 5d0f4bf0d97fa7fce35d2480f5512d80b949cd98 Mon Sep 17 00:00:00 2001 From: Giriharan Date: Tue, 5 Nov 2024 14:09:00 +0530 Subject: [PATCH] fix: issue due to invalid type in example --- examples/auth/get_workspace_id.py | 6 ++- .../clients/auth/models/_auth_policy.py | 15 ++++-- nisystemlink/clients/auth/models/_user.py | 53 ++++++++++++++++--- 3 files changed, 62 insertions(+), 12 deletions(-) diff --git a/examples/auth/get_workspace_id.py b/examples/auth/get_workspace_id.py index c2536302..ed6a44a1 100644 --- a/examples/auth/get_workspace_id.py +++ b/examples/auth/get_workspace_id.py @@ -9,21 +9,25 @@ server_api_key = "" # SystemLink API key workspace_name = "" # Systemlink workspace name +# Provide the valid API key and API URL for client initialization. auth_client = AuthClient( HttpConfiguration(server_uri=server_url, api_key=server_api_key) ) +# Getting workspace ID. try: + # Get the caller details for workspaces information. caller_info = auth_client.get_auth_info() workspaces = caller_info.workspaces if caller_info.workspaces else None workspace_id = None + # Get the required workspace information for getting ID. if workspaces: workspace_info = get_workspace_by_name( workspaces=workspaces, name=workspace_name, ) - workspace_id = workspace_info.id + workspace_id = workspace_info.id if workspace_info else None if workspace_id: print(f"Workspace ID: {workspace_id}") diff --git a/nisystemlink/clients/auth/models/_auth_policy.py b/nisystemlink/clients/auth/models/_auth_policy.py index 096de0b1..51495362 100644 --- a/nisystemlink/clients/auth/models/_auth_policy.py +++ b/nisystemlink/clients/auth/models/_auth_policy.py @@ -9,11 +9,20 @@ class AuthStatement(JsonModel): """Auth Statement information.""" actions: Optional[List[str]] = None - """A list of actions the user is allowed to perform.""" + """A list of actions the user is allowed to perform. + + example: notebookexecution:Query + """ resource: Optional[List[str]] = None - """A list of resources the user is allowed to access.""" + """A list of resources the user is allowed to access. + + example: Notebook + """ workspace: Optional[str] = None - """The workspace the user is allowed to access.""" + """The workspace the user is allowed to access. + + example: 5afb2ce3741fe11d88838cc9 + """ class Statement(AuthStatement): diff --git a/nisystemlink/clients/auth/models/_user.py b/nisystemlink/clients/auth/models/_user.py index ac14c5d4..7b47c2f7 100644 --- a/nisystemlink/clients/auth/models/_user.py +++ b/nisystemlink/clients/auth/models/_user.py @@ -29,34 +29,71 @@ class User(JsonModel): """User information.""" id: Optional[str] = None - """The unique id.""" + """The unique id. + + example: "47d-47c7-8dd1-70f63de3583f" + """ + first_name: Optional[str] = None """The user's first name.""" + last_name: Optional[str] = None """The user's last name.""" + email: Optional[str] = None - """The user's email.""" + """The user's email. + + example: example@email.com + """ + phone: Optional[str] = None - """The user's contact phone number.""" + """The user's contact phone number. + + example: 555-555-5555 + """ + niua_id: Optional[str] = None - """The external id (niuaId, SID, login name).""" + """The external id (niuaId, SID, login name). + + example: example@email.com + """ + login: Optional[str] = None """ The login name of the user. This the "username" or equivalent entered when the user authenticates with the identity provider. """ + accepted_to_s: Optional[bool] = None """(deprecated) Whether the user accepted the terms of service.""" + properties: Optional[Dict[str, str]] = None - """A map of key value properties.""" + """A map of key value properties. + + example: { "key1": "value1" } + """ + keywords: Optional[List[str]] = None """A list of keywords associated with the user.""" + created: Optional[datetime] = None - """The created timestamp.""" + """The created timestamp. + + example: 2019-12-02T15:31:45.379Z + """ + updated: Optional[datetime] = None - """The last updated timestamp.""" + """The last updated timestamp. + + example: 2019-12-02T15:31:45.379Z + """ + org_id: Optional[str] = None - """The id of the organization.""" + """The id of the organization. + + example: "47d-47c7-8dd1-70f63de3435f" + """ + policies: Optional[List[str]] = None """A list of policy ids to reference existing policies.""" status: Optional[Status] = None