Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ def list_workspace_settings(self, workspace_id: str) -> list[CatalogWorkspaceSet
workspace_settings = load_all_entities(get_workspace_settings).data
return [CatalogWorkspaceSetting.from_api(ws) for ws in workspace_settings]

def resolve_all_workspace_settings(self, workspace_id: str) -> dict:
def resolve_all_workspace_settings(self, workspace_id: str, exclude_user_settings: bool = False) -> dict:
"""
Resolves values for all settings in a workspace by current user, workspace, organization, or default settings
and return them as a dictionary. Proper parsing is up to the caller.
TODO: long-term we should return a proper entity object.

:param workspace_id: Workspace ID
:param exclude_user_settings: If true, user-level settings are excluded from resolution
:return: Dict of settings
"""
# note: in case some settings were recently added and the API client was not regenerated it can fail on
Expand All @@ -205,26 +206,29 @@ def resolve_all_workspace_settings(self, workspace_id: str) -> dict:
setting.to_dict()
for setting in self._client.actions_api.workspace_resolve_all_settings(
workspace_id,
exclude_user_settings=exclude_user_settings,
_check_return_type=False,
)
]
return {setting["type"]: setting for setting in resolved_workspace_settings}

def resolve_workspace_settings(self, workspace_id: str, settings: list) -> dict:
def resolve_workspace_settings(self, workspace_id: str, settings: list, exclude_user_settings: bool = False) -> dict:
"""
Resolves values for given settings in a workspace by current user, workspace, organization, or default settings
and return them as a dictionary. Proper parsing is up to the caller.
TODO: long-term we should return a proper entity object.

:param workspace_id: Workspace ID
:param settings: List of settings to resolve
:param exclude_user_settings: If true, user-level settings are excluded from resolution
:return: Dict of settings
"""
resolved_workspace_settings = [
setting.to_dict()
for setting in self._client.actions_api.workspace_resolve_settings(
workspace_id,
ResolveSettingsRequest(settings=settings),
exclude_user_settings=exclude_user_settings,
_check_return_type=False,
)
]
Expand Down
Loading