Skip to content

docs: Update download_dashboards example and get_dashboards documentation #178

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

Merged
merged 1 commit into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/download_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def cleanup_dir(path):
#
# Fire the request.
#
ok, res = sdclient.get_dashboards()
ok, res = sdclient.get_dashboards(light=False)

#
# Show the list of dashboards
Expand Down
32 changes: 23 additions & 9 deletions sdcclient/monitor/_dashboards_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,29 @@ def get_view(self, name):
return self._request_result(res)

def get_dashboards(self, light=True):
'''**Description**
Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users.

**Success Return Value**
A dictionary containing the list of available sampling intervals.

**Example**
`examples/list_dashboards.py <https://github.com/draios/python-sdc-client/blob/master/examples/list_dashboards.py>`_
'''
"""
Return the list of dashboards available under the given user account.
This includes the dashboards created by the user and the ones shared with her by other users.
Since every user has multiple tokens -- one per team they are assigned to -- and dashboards are scoped per
team, in order to download all the dashboards from a user account, all the tokens must be specified.

Args:
light (bool): If it's true, only a small portion of information will be retrieved, otherwise all
the information from the dashboards will be retrieved.
If the retrieved dashboards are going to be restored in the future, then this
parameter must be false.

Returns:
The list of the dashboards visible for the given token.

See Also:
:py:meth:`~.DashboardsClientV3.create_dashboard_with_configuration`

Examples:
>>> ok, res = client.get_dashboards(light=False)
>>> for dashboard in res["dashboards"]:
>>> print(dashboard["name"])
"""
params = {
"light": "true" if light else "false"
}
Expand Down