Skip to content

Commit

Permalink
fix: issue due to invalid type in example
Browse files Browse the repository at this point in the history
  • Loading branch information
Giriharan219 committed Nov 5, 2024
1 parent dfb0fab commit 5d0f4bf
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 12 deletions.
6 changes: 5 additions & 1 deletion examples/auth/get_workspace_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
15 changes: 12 additions & 3 deletions nisystemlink/clients/auth/models/_auth_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
53 changes: 45 additions & 8 deletions nisystemlink/clients/auth/models/_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
"""

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: [email protected]
"""

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
Expand Down

0 comments on commit 5d0f4bf

Please sign in to comment.