Commit Graph

6 Commits

Author SHA1 Message Date
Ian Wienand 2c3823432d Generate and use UID for acessing dashboards
We are relying on the "slug" field being the same as our "url
friendly" title that we create.  For whatever reason the slug field
was deprecated in Grafana v5.0, and now with v8.3.4 it has stopped
working.

We can turn the name/slug into a UID by hashing, and then use this in
the various API calls.

Change-Id: I13d3162c917e094684756e51836d12000621fefa
2022-01-25 10:59:28 +11:00
Paul Belanger fd76590e4b Add delete command to CLI
Add the ability to delete dashboards based on the provided yaml file.
We also removed the assert_dashboard_exists function, as it didn't
really save us code.

Change-Id: I417a72fcc5252b36cadfe8881b4f5ca6acb7c753
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-16 11:33:32 -04:00
Paul Belanger 3a32d511bb Rework grafana object for future functionality
Currently we only support dashboards for Grafana, this is about to
change. For example, we also need to add the ability to create
datasources and even users. Here we are breaking out the logic into
more specific functions.

Additionaly, this helps when we eventually break out this code into
python-grafana.

Change-Id: I10a618adbf9052c8dccda38fefb7abf3a148d3b6
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-09 14:00:28 -04:00
Paul Belanger 30f7d21f3f Make sure dashboard exists after we create it
The long term goal here is to eventually create python-grafana from
our embedded grafana.py file. So, most of this code just makes the
Grafana object more user friendly.

However, we've also added some validation around create_dashboard, we
added some checks before we create and after. To ensure we actually
created our new dashboards.

Finally, add some sphinx docs since everybody loves documentation.

Change-Id: Icbba403afe5208fbef1855118d4c3f4293461e00
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-02 13:42:35 -04:00
Paul Belanger b5ecab6d05 Refactor grafana.py test coverage
Add 2 new tests for the __init__ function. Testing with / without the
apikey.  Also rework our requests_mock logic.

Change-Id: Idea77b59b1ea2d6a2566e48810aa19c0455479ac
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 14:09:54 -04:00
Paul Belanger 29c17b9d23 Add test coverate for grafana.py
Previous to this we actually didn't install our requests dependency.
So grafyaml actually didn't work :( Now we have basic coverage with
mock.

Change-Id: I771ea12e444ea851d76983df75f69d1569653f9d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-25 13:03:53 -04:00