Skip to content

Commit 066a6d8

Browse files
authored
Cw 4 + 5 add alerting and data source support (#2)
* Optimize the GitHub action, the logging type and add the alerting functionality * Add notification channel support * Add new functionality and unittests * Move API to legacy endpoint * Add V8 alerting support * Add coverage badge and documentation
1 parent 309ef93 commit 066a6d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8918
-691
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ jobs:
4141
--wheel
4242
--outdir dist/
4343
44+
- name: Setup the GitHub user
45+
run: |
46+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
47+
git config --local user.name "github-actions[bot]"
48+
49+
- name: Update the GitHub pages documentation
50+
run: cd docs && mkdocs gh-deploy --force && cd ..
51+
4452
- name: Publish distribution package to PyPI
4553
if: startsWith(github.ref, 'refs/tags')
4654
uses: pypa/gh-action-pypi-publish@master

.github/workflows/pull-request-checks.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,30 @@ jobs:
8787
hide-badge: true
8888
create-new-commit: true
8989

90-
- name: "Check if coverage badge file existence"
91-
id: check_files
92-
uses: andstor/file-existence-action@v1
93-
with:
94-
files: "docs/coverage.svg"
95-
9690
- name: Generate coverage badge
97-
if: steps.check_files.outputs.files_exists == 'false'
98-
run: coverage-badge -o docs/coverage.svg -f
91+
run: coverage-badge -f -o docs/coverage.svg
92+
93+
- name: Generate documentation
94+
run: pydoc-markdown --render-toc && mv build/docs/* docs
95+
96+
- name: Check changed files
97+
uses: tj-actions/[email protected]
98+
id: verify-changed-files
99+
with:
100+
files: |
101+
docs
99102
100103
- name: Commit files
101-
if: steps.check_files.outputs.files_exists == 'false'
104+
if: steps.verify-changed-files.outputs.files_changed == 'true'
102105
run: |
103106
git config --local user.email "github-actions[bot]@users.noreply.github.com"
104107
git config --local user.name "github-actions[bot]"
105-
git add --force docs/coverage.svg
106-
git commit -m "Add coverage badge"
108+
git add --force docs
109+
git commit -m "Add coverage badge and documentation"
107110
108111
- name: Push changes
109-
if: steps.check_files.outputs.files_exists == 'false'
110112
uses: ad-m/github-push-action@master
113+
if: steps.verify-changed-files.outputs.files_changed == 'true'
111114
with:
112115
github_token: ${{ secrets.GITHUB_TOKEN }}
113116
branch: ${{ github.head_ref }}

README.md

Lines changed: 82 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,94 @@ The repository includes an SDK for the Grafana API. It's possible to communicate
2828
### Search
2929
- Execute a custom query against the Grafana search endpoint
3030

31+
### Datasource
32+
- Get all datasources
33+
- Get the datasource by id
34+
- Get the datasource by uid
35+
- Get the datasource by name
36+
- Get the datasource id by name
37+
- Create a new datasource
38+
- Update a datasource
39+
- Delete a datasource by id
40+
- Delete a datasource by uid
41+
- Delete a datasource by name
42+
- Query a datasource by id
43+
- Enabled datasource permissions
44+
- Disable datasource permissions
45+
- Get datasource permissions
46+
- Add datasource permissions
47+
- Delete datasource permissions
48+
49+
### Legacy Alerting
50+
- Get alerts
51+
- Get alerts by dashboard ids
52+
- Get alert by id
53+
- Pause alert by id
54+
- Unpause alert by id
55+
56+
### Alerting
57+
- Get all Alertmanager alerts
58+
- Create or update Alertmanager alerts
59+
- Get Alertmanager group alerts
60+
61+
- Get all Alertmanager silences
62+
- Get Alertmanager silence by id
63+
- Create or update Alertmanager silence
64+
- Delete Alertmanager silence by id
65+
- Get Alertmanager status
66+
- Get the Alertmanager config
67+
- Create or update the Alertmanager config
68+
- Delete the Alertmanager config
69+
- Test the Alertmanager receivers
70+
- Get Prometheus alerts
71+
- Get Prometheus rules
72+
- Get Ruler rules
73+
- Get a Ruler group
74+
- Get Ruler groups by the namespace
75+
- Create or update the Ruler group by the namespace
76+
- Delete a Ruler group
77+
- Delete a Ruler namespace
78+
- Test a datasource rule
79+
- Test a recipient rule
80+
- Get the NGAlert organization configuration
81+
- Get the NGAlert Alertmanager configuration by the organization
82+
- Create or update the NGAlert organization configuration
83+
- Delete the NGAlert organization configuration
84+
85+
### Alerting Channels
86+
- Get all notification channels
87+
- Get all notification channels (lookup)
88+
- Get a notification channel by id
89+
- Get a notification channel by uid
90+
- Create an notification channel
91+
- Update a notification channel by id
92+
- Update a notification channel by uid
93+
- Delete a notification channel by id
94+
- Delete a notification channel by uid
95+
- Test a notification channel
96+
3197
## Feature timeline
3298

3399
The following table describes the plan to implement the rest of the Grafana API functionality. Please, open an issue and vote them up, if you prefer a faster implementation of an API functionality.
34100

35101
| API endpoint group | Implementation week | Maintainer | PR | State |
36102
|:------------------:|:-------------------:|:----------:|:--:|:-----:|
37-
| [Admin HTTP API](https://grafana.com/docs/grafana/latest/http_api/admin/) | | | | |
38-
| [Alerting HTTP API](https://grafana.com/docs/grafana/latest/http_api/alerting/) | 4 | [ZPascal](https://github.com/ZPascal) | | Planned |
39-
| [Alerting Notification Channels HTTP API](https://grafana.com/docs/grafana/latest/http_api/alerting_notification_channels/) | 4 | [ZPascal](https://github.com/ZPascal) | | Planned |
40-
| [Annotations HTTP API](https://grafana.com/docs/grafana/latest/http_api/annotations/) | | | | |
41-
| [Authentication HTTP API](https://grafana.com/docs/grafana/latest/http_api/auth/) | | | | |
42-
| [Data source HTTP API](https://grafana.com/docs/grafana/latest/http_api/data_source/) | 5 | [ZPascal](https://github.com/ZPascal) | | Planned |
43-
| [Datasource Permissions HTTP API](https://grafana.com/docs/grafana/latest/http_api/datasource_permissions/) | | | | |
44-
| [External Group Sync HTTP API](https://grafana.com/docs/grafana/latest/http_api/external_group_sync/) | | | | |
45-
| [Fine-grained access control HTTP API](https://grafana.com/docs/grafana/latest/http_api/access_control/) | | | | |
46-
| [HTTP Preferences API](https://grafana.com/docs/grafana/latest/http_api/preferences/) | | | | |
47-
| [HTTP Snapshot API](https://grafana.com/docs/grafana/latest/http_api/snapshot/) | | | | |
48-
| [Library Element HTTP API](https://grafana.com/docs/grafana/latest/http_api/library_element/) | | | | |
49-
| [Licensing HTTP API](https://grafana.com/docs/grafana/latest/http_api/licensing/) | | | | |
50-
| [Organization HTTP API](https://grafana.com/docs/grafana/latest/http_api/org/) | | | | |
51-
| [Other HTTP API](https://grafana.com/docs/grafana/latest/http_api/other/) | | | | |
52-
| [Playlist HTTP API](https://grafana.com/docs/grafana/latest/http_api/playlist/) | | | | |
53-
| [Reporting API](https://grafana.com/docs/grafana/latest/http_api/reporting/) | | | | |
54-
| [Short URL HTTP API](https://grafana.com/docs/grafana/latest/http_api/short_url/) | | | | |
55-
| [Team HTTP API](https://grafana.com/docs/grafana/latest/http_api/team/) | | | | |
56-
| [User HTTP API](https://grafana.com/docs/grafana/latest/http_api/user/) | | | | |
103+
| [Admin HTTP API](https://grafana.com/docs/grafana/latest/http_api/admin/) | | | | |
104+
| [Annotations HTTP API](https://grafana.com/docs/grafana/latest/http_api/annotations/) | | | | |
105+
| [Authentication HTTP API](https://grafana.com/docs/grafana/latest/http_api/auth/) | | | | |
106+
| [External Group Sync HTTP API](https://grafana.com/docs/grafana/latest/http_api/external_group_sync/) | | | | |
107+
| [Fine-grained access control HTTP API](https://grafana.com/docs/grafana/latest/http_api/access_control/) | | | | |
108+
| [HTTP Preferences API](https://grafana.com/docs/grafana/latest/http_api/preferences/) | | | | |
109+
| [HTTP Snapshot API](https://grafana.com/docs/grafana/latest/http_api/snapshot/) | | | | |
110+
| [Library Element HTTP API](https://grafana.com/docs/grafana/latest/http_api/library_element/) | | | | |
111+
| [Licensing HTTP API](https://grafana.com/docs/grafana/latest/http_api/licensing/) | | | | |
112+
| [Organization HTTP API](https://grafana.com/docs/grafana/latest/http_api/org/) | 13 | | | In process |
113+
| [Other HTTP API](https://grafana.com/docs/grafana/latest/http_api/other/) | | | | |
114+
| [Playlist HTTP API](https://grafana.com/docs/grafana/latest/http_api/playlist/) | | | | |
115+
| [Reporting API](https://grafana.com/docs/grafana/latest/http_api/reporting/) | | | | |
116+
| [Short URL HTTP API](https://grafana.com/docs/grafana/latest/http_api/short_url/) | 13 | | | In process |
117+
| [Team HTTP API](https://grafana.com/docs/grafana/latest/http_api/team/) | | | | |
118+
| [User HTTP API](https://grafana.com/docs/grafana/latest/http_api/user/) | | | | |
57119

58120
## Installation
59121

docs/.placeholder

Whitespace-only changes.

0 commit comments

Comments
 (0)