From bfd9308a0cf3e683733da7425499abafb4fcaa98 Mon Sep 17 00:00:00 2001 From: Giriharan Date: Thu, 7 Nov 2024 12:27:52 +0530 Subject: [PATCH] fix: self review comments --- examples/auth/get_workspace_id.py | 5 +++-- nisystemlink/clients/auth/_auth_client.py | 9 ++++++++- nisystemlink/clients/auth/models/_auth_info.py | 8 ++++---- nisystemlink/clients/auth/utilities/__init__.py | 5 +++++ .../{utilities.py => utilities/_get_workspace_info.py} | 2 +- 5 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 nisystemlink/clients/auth/utilities/__init__.py rename nisystemlink/clients/auth/{utilities.py => utilities/_get_workspace_info.py} (94%) diff --git a/examples/auth/get_workspace_id.py b/examples/auth/get_workspace_id.py index ed6a44a1..3e6ef70d 100644 --- a/examples/auth/get_workspace_id.py +++ b/examples/auth/get_workspace_id.py @@ -1,10 +1,11 @@ """Example of getting workspace ID.""" from nisystemlink.clients.auth import AuthClient -from nisystemlink.clients.auth.utilities import get_workspace_by_name +from nisystemlink.clients.auth.utilities._get_workspace_info import ( + get_workspace_by_name, +) from nisystemlink.clients.core import ApiException, HttpConfiguration - server_url = "" # SystemLink API URL server_api_key = "" # SystemLink API key workspace_name = "" # Systemlink workspace name diff --git a/nisystemlink/clients/auth/_auth_client.py b/nisystemlink/clients/auth/_auth_client.py index adeb6148..2ecaccf2 100644 --- a/nisystemlink/clients/auth/_auth_client.py +++ b/nisystemlink/clients/auth/_auth_client.py @@ -29,5 +29,12 @@ def __init__(self, configuration: Optional[core.HttpConfiguration] = None): @get("auth") def get_auth_info(self) -> models.AuthInfo: - """Gets information about the authenticated API Key.""" + """Gets information about the authenticated API Key. + + Returns: + models.AuthInfo: Information about the caller. + + Raises: + ApiException: if unable to communicate with the Auth Service. + """ ... diff --git a/nisystemlink/clients/auth/models/_auth_info.py b/nisystemlink/clients/auth/models/_auth_info.py index 8bf3d83d..c63525e8 100644 --- a/nisystemlink/clients/auth/models/_auth_info.py +++ b/nisystemlink/clients/auth/models/_auth_info.py @@ -12,13 +12,13 @@ class AuthInfo(JsonModel): """Information about the authenticated caller.""" - user: Optional[User] + user: Optional[User] = None """Details of authenticated caller.""" - org: Optional[Org] + org: Optional[Org] = None """Organization of authenticated caller.""" - workspaces: Optional[List[Workspace]] + workspaces: Optional[List[Workspace]] = None """List of workspaces the authenticated caller has access.""" - policies: Optional[List[AuthPolicy]] + policies: Optional[List[AuthPolicy]] = None """List of policies for the authenticated caller.""" properties: Optional[Dict[str, str]] = None """A map of key value properties.""" diff --git a/nisystemlink/clients/auth/utilities/__init__.py b/nisystemlink/clients/auth/utilities/__init__.py new file mode 100644 index 00000000..7fa9b593 --- /dev/null +++ b/nisystemlink/clients/auth/utilities/__init__.py @@ -0,0 +1,5 @@ +from nisystemlink.clients.auth.utilities._get_workspace_info import ( + get_workspace_by_name, +) + +# flake8: noqa diff --git a/nisystemlink/clients/auth/utilities.py b/nisystemlink/clients/auth/utilities/_get_workspace_info.py similarity index 94% rename from nisystemlink/clients/auth/utilities.py rename to nisystemlink/clients/auth/utilities/_get_workspace_info.py index 36bc10aa..827a4824 100644 --- a/nisystemlink/clients/auth/utilities.py +++ b/nisystemlink/clients/auth/utilities/_get_workspace_info.py @@ -1,4 +1,4 @@ -"""Utilities for Auth Client.""" +"""Get workspace information.""" from typing import List, Optional