-
Notifications
You must be signed in to change notification settings - Fork 58
SVS-1245-add-custom-fields-to-gooddata-pipelines #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVS-1245-add-custom-fields-to-gooddata-pipelines #1151
Conversation
3dcbaa4
to
e4ec7a3
Compare
def get_workspace_layout(self, workspace_id: str) -> requests.Response: | ||
"""Get the layout of the specified workspace. | ||
Args: | ||
workspace_id (str): The ID of the workspace to retrieve the layout for. | ||
Returns: | ||
requests.Response: The response containing the workspace layout. | ||
""" | ||
endpoint = f"/layout/workspaces/{workspace_id}" | ||
return self._get(endpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use get_declarative_workspace
from gooddata_sdk?
def put_workspace_layout( | ||
self, workspace_id: str, layout: dict[str, Any] | ||
) -> requests.Response: | ||
"""Update the layout of the specified workspace. | ||
Args: | ||
workspace_id (str): The ID of the workspace to update. | ||
layout (dict[str, Any]): The new layout to set for the workspace. | ||
Returns: | ||
requests.Response: The response from the server after updating the layout. | ||
""" | ||
endpoint = f"/layout/workspaces/{workspace_id}" | ||
headers = {**self.headers, "Content-Type": "application/json"} | ||
return self._put(endpoint, data=layout, headers=headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use put_declarative_workspace
from gooddata_sdk?
@staticmethod | ||
def _set_contains(set_to_check: set[Any], item: Any) -> bool: | ||
"""Helper function to check if an item is in a set.""" | ||
return item in set_to_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method necessary? Why not simplify do the item in set_to_check
?
if set_new_invalid_relations.issubset(set_current_invalid_relations): | ||
return True | ||
else: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if set_new_invalid_relations.issubset(set_current_invalid_relations): | |
return True | |
else: | |
return False | |
return set_new_invalid_relations.issubset(set_current_invalid_relations) |
metrics_response = self._api.get_all_metrics(workspace_id) | ||
visualizations_response = self._api.get_all_visualization_objects( | ||
workspace_id | ||
) | ||
dashboards_response = self._api.get_all_dashboards(workspace_id) | ||
self._api.raise_if_response_not_ok( | ||
metrics_response, | ||
visualizations_response, | ||
dashboards_response, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use any methods from gooddata_sdk
? This seems to me like re-implementing something that already exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. I need to use the "X-GDC-VALIDATE-RELATIONS": "true"
header for these to get the areRelationsValid
attribute. I didn't see a way to get that using the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see... maybe we could extend the gooddata_sdk to set custom headers somehow. Let's leave it for follow-up.
e4ec7a3
to
67d1d9b
Compare
No description provided.