38 Commits

Author SHA1 Message Date
fd6fd91115 Prometheus: Add support for cloud partners Prometheus data sources (#103482)
* wip

* Add prom flavor support for data source variables and export/import dashboards (#103321)

* add dashboard and data source var selection

* use match plugin id instead

* use updated matchpluginid

* formatting

* cleanup

* regex anchor

* update error msg

* Alerting: Clean up prometheus-flavored types and functions (#103703)

* clean up types and utility functions for dealing with
prometheus-flavored data sources

* Refactor alerting datasource types to use constants as source of truth

* Alerting: Clean up prometheus-flavored types and functions on the bac… (#103716)

Alerting: Clean up prometheus-flavored types and functions on the backend

* add matchPluginId tests

* Update matchPluginId func to bidirectional (#103746)

* update matchpluginid func to bidirectional

* lint

* formatting

* use actual isSupportedExternalRulesSourceType in test

* add tests in datasource_srv

* betterer

* remove type assertion

* remove unnecessary case

* use satisifies to not have to convert tuple to an array of string

* add prometheus_flavor test

---------

Co-authored-by: Andrew Hackmann <5140848+bossinc@users.noreply.github.com>
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: Alexander Akhmetov <me@alx.cx>
2025-04-10 12:49:11 -07:00
32643c933e LBAC for datasources: GA (#99511)
* GA: feature toggle removal of `teamHttpHeaders`

* Apply suggestions from code review

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2025-02-20 10:26:46 +00:00
b1e1297bb3 LBAC for datasources: Move validation of rules from datasources to LBAC Rules (#94622)
* FIX: Remove the checks for lbac rules inside of datasources

* Remove json validation for lbac rules

* Preserve lbac rules in updates

* Refactored test to remove the table structure

* refactor: change to allow naming and concise override instead of complex branching

* refactor to make sure we set an empty field for updates

* bugfix

* check for datasources.JsonData

* fix merge

* add datasource to check for field presence only

* add function call for readability
2024-10-25 10:07:53 +01:00
458fc69616 IAM: Add test for AddDataSource managed permissions (#94113)
Add test for AddDataSource managed permissions and fix control flow issues
2024-10-04 06:35:25 -05:00
01a4e6b9af Remove the need for plugins to implement AdmissionHandler for v0alpha1 (#93272) 2024-09-13 09:08:26 +02:00
e60b0aef83 Plugins: Add support for ResourceConversion (#91977) 2024-08-15 16:02:21 -04:00
9bb2cf4968 RBAC: Allow omitting default permissions when a new resource is created (#90720)
* Cfg: Move rbac settings to own struct

* Cfg: Add setting to control if resource should generate managed permissions when created

* Dashboards: Check if we should generate default permissions when dashboard is created

* Folders: Check if we should generate default permissions when folder is created

* Datasource: Check if we should generate default permissions when datasource is created

* ServiceAccount: Check if we should generate default permissions when service account is created

* Cfg: Add option to specify resources for wich we should default seed

* ManagedPermissions: Move providers to their own files

* Dashboards: Default seed all possible managed permissions if configured

* Folders: Default seed all possible managed permissions if configured

* Cfg: Remove service account from list

* RBAC: Move utility function

* remove managed permission settings from the config file examples, change the setting names

* remove ini file changes from the PR

* fix setting reading

* fix linting errors

* fix tests

* fix wildcard role seeding

---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: jguer <me@jguer.space>
2024-07-24 19:31:26 +03:00
a22c1ae424 Chore: Remove provisional APIVersion from plugin info (#89831) 2024-07-01 10:53:16 +02:00
c16f502ec5 Access Control: Clean up permissions for deprovisioned data sources (#88483)
* make sure that DS permissions get correctly cleaned up when a DS is deleted through provisioning

* don't attempt to delete a DS if it's not found

* fixes for tests

* fix ds tests

* rename DS service used by DS provisioner to BaseDataSourceService to avoid confusions with the full DS service
2024-06-03 16:19:53 +03:00
0f32c2bff9 Revamp tests for Add/Update Datasource (#88386) 2024-05-29 04:54:11 -05:00
60ce523b72 Refactor plugin context initialization (#88343) 2024-05-28 16:59:06 +03:00
ffc2702552 Plugins: Support Admission validation hooks (#87718) 2024-05-24 18:45:16 +03:00
d8904f3ca4 Add apiVersion to plugin models (#87510) 2024-05-14 13:58:27 +02:00
257cc98062 Datasources: Remove unused functions (#85473)
* cleanup unused funcs

* remove more stuff
2024-04-02 16:19:52 +02:00
6137c4e0a6 Chore: Bump golangci-lint v1.57.1 (#84998)
* bump golangci-lint v1.57.1

* update setting

* remove goconst

* fix linting issues

* prettier

* fix G601

* go mod tidy
go work sync
2024-03-25 15:28:24 +01:00
265200799d Chore: Update grafana-plugin-sdk (#84289) 2024-03-12 17:13:23 +01:00
790e1feb93 Chore: Update test database initialization (#81673)
* streamline initialization of test databases, support on-disk sqlite test db

* clean up test databases

* introduce testsuite helper

* use testsuite everywhere we use a test db

* update documentation

* improve error handling

* disable entity integration test until we can figure out locking error
2024-02-09 09:35:39 -05:00
6768c6c059 Chore: Remove public vars in setting package (#81018)
Removes the public variable setting.SecretKey plus some other ones. 
Introduces some new functions for creating setting.Cfg.
2024-01-23 12:36:22 +01:00
67fe33aa62 Datasources: Ensure the 'Host' custom header functions as expected (#80715)
Supports "Host" custom header.

Co-authored-by: Pei-Tang Huang <tangtheone@gmail.com>
2024-01-17 13:38:45 +01:00
9a3b2937aa Data sources: Refactor logic for naming new data sources (#78479)
* move the name finding logic for new data sources from frontend to backend

* cleanup and fix test

* linting

* change the way the number after the ds type is incremented - keep incrementing it without adding more hyphens

* enterprise spec updates (unrelated to the PR)
2023-11-22 09:57:26 +00:00
1dd97301e5 Chore: Adapt GetDataSourcesByType to plugins with aliases (#76637) 2023-10-17 11:09:56 +02:00
025b2f3011 Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
2c949a6a33 Proxy: Set the proxy information in Grafana for Graphite (#72777) 2023-08-03 15:11:02 +03:00
a912c970e3 Provisioning: Fix overwrite SecureJSONData on provisioning (#72395)
* Overwrite SecureJSONData on provisioning
2023-07-27 11:11:43 +02:00
60496fbae3 Chore: Return correct error for name taken and validation error on add/update datasource (#70465) 2023-07-17 16:27:19 +02:00
42cdec369d Datasources: provide generic function to extract custom headers (#66738) 2023-04-19 17:04:30 +02:00
39a4634ae9 Plugins: Fix bug with copying grafanaData (#64446) 2023-03-08 11:21:01 -07:00
49b3027049 Chore: Remove Result field from datasources (#63048)
* Remove Result field from AddDataSourceCommand
* Remove DatasourcesPermissionFilterQuery Result
* Remove GetDataSourceQuery Result
* Remove GetDataSourcesByTypeQuery Result
* Remove GetDataSourcesQuery Result
* Remove GetDefaultDataSourceQuery Result
* Remove UpdateDataSourceCommand Result
2023-02-09 15:49:44 +01:00
23c27cffb3 Chore: Rename Id to ID in alerting models (#62777)
* Chore: Rename Id to ID in alerting models

* Add xorm tags for datasource

* Add xorm tag for uid
2023-02-02 17:22:43 +01:00
c41f97029e Plugins: Fix circular reference in customOptions leading to MarshalJSON errors (#62328)
* Plugins: test ds.JsonData.MarshalJSON()

* CustomOptions: copy to avoid cyclic marshal
2023-01-31 12:35:36 +01:00
386faf5958 OpenSearch: Use aoss servicename if OpenSearch is configured as serverless (#60344)
* Use `aoss` if opensearch is configured as `serverless`
2022-12-14 20:22:26 +01:00
55d2d872ec Chore: Missed deprecations due to overly broad lint exclusion (#59732) 2022-12-14 12:32:45 +01:00
c02003af3c Refactor time durations (#58484)
This change uses `time.Second` in place of `1000 * time.Millisecond` and `time.Minute` in place of `60*time.Second`.
2022-11-22 15:09:15 +08:00
9855e74b92 Chore: Refactor quota service (#58643)
Chore: Refactor quota service (#57586)

* Chore: refactore quota service

* Apply suggestions from code review
2022-11-14 21:08:10 +02:00
96cdf77995 Revert "Chore: Refactor quota service (#57586)" (#58394)
This reverts commit 326ea86a579ed927b1999bba5f2c0a35e26506d9.
2022-11-08 11:52:07 +02:00
326ea86a57 Chore: Refactor quota service (#57586)
* Chore: refactore quota service

* Apply suggestions from code review
2022-11-08 10:25:34 +02:00
05709ce411 chore: remove sqlstore & mockstore dependencies from (most) packages (#57087)
* chore: add alias for InitTestDB and Session

Adds an alias for the sqlstore InitTestDB and Session, and updates tests using these to reduce dependencies on the sqlstore.Store.

* next pass of removing sqlstore imports
* last little bit
* remove mockstore where possible
2022-10-19 09:02:15 -04:00
6227528ea0 Chore: SQL Store Split of datasource (#54262)
* refectory datasource

* fix linter
2022-08-26 11:03:38 -04:00