|
30 | 30 | * [disable\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.disable_datasource_cache)
|
31 | 31 | * [clean\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.clean_datasource_cache)
|
32 | 32 | * [update\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.update_datasource_cache)
|
| 33 | + * [DatasourceLabelBasedAccessControl](#datasource.DatasourceLabelBasedAccessControl) |
| 34 | + * [get\_lbac\_rules\_for\_datasource](#datasource.DatasourceLabelBasedAccessControl.get_lbac_rules_for_datasource) |
| 35 | + * [update\_lbac\_rules\_for\_datasource](#datasource.DatasourceLabelBasedAccessControl.update_lbac_rules_for_datasource) |
33 | 36 |
|
34 | 37 | <a id="datasource"></a>
|
35 | 38 |
|
@@ -852,3 +855,80 @@ The method includes a functionality to update the datasource cache specified by
|
852 | 855 |
|
853 | 856 | - `api_call` _dict_ - Returns a datasource
|
854 | 857 |
|
| 858 | +<a id="datasource.DatasourceLabelBasedAccessControl"></a> |
| 859 | + |
| 860 | +## DatasourceLabelBasedAccessControl Objects |
| 861 | + |
| 862 | +```python |
| 863 | +class DatasourceLabelBasedAccessControl() |
| 864 | +``` |
| 865 | + |
| 866 | +The class includes all necessary methods to access the Grafana datasource label based access control for teams API endpoints. It's required that the API token got the corresponding datasource access rights. Please check the used methods docstring for the necessary access rights. The functionality is a Grafana Cloud feature. Only cloud Loki data sources are supported |
| 867 | + |
| 868 | +**Arguments**: |
| 869 | + |
| 870 | +- `grafana_api_model` _APIModel_ - Inject a Grafana API model object that includes all necessary values and information |
| 871 | + |
| 872 | + |
| 873 | +**Attributes**: |
| 874 | + |
| 875 | +- `grafana_api_model` _APIModel_ - This is where we store the grafana_api_model |
| 876 | + |
| 877 | +<a id="datasource.DatasourceLabelBasedAccessControl.get_lbac_rules_for_datasource"></a> |
| 878 | + |
| 879 | +#### get\_lbac\_rules\_for\_datasource |
| 880 | + |
| 881 | +```python |
| 882 | +def get_lbac_rules_for_datasource(uid: str) -> list |
| 883 | +``` |
| 884 | + |
| 885 | +The method includes a functionality to get all datasource label based access control rules for team specified by the datasource uid |
| 886 | + |
| 887 | +**Arguments**: |
| 888 | + |
| 889 | +- `uid` _str_ - Specify the uid of the datasource |
| 890 | + |
| 891 | + Required Permissions: |
| 892 | +- `Action` - datasources:read |
| 893 | +- `Scope` - [datasources:*, datasources:uid:*, datasources:uid:<id>] |
| 894 | + |
| 895 | + |
| 896 | +**Raises**: |
| 897 | + |
| 898 | +- `ValueError` - Missed specifying a necessary value |
| 899 | +- `Exception` - Unspecified error by executing the API call |
| 900 | + |
| 901 | + |
| 902 | +**Returns**: |
| 903 | + |
| 904 | +- `api_call` _list_ - Returns all LBAC rules |
| 905 | + |
| 906 | +<a id="datasource.DatasourceLabelBasedAccessControl.update_lbac_rules_for_datasource"></a> |
| 907 | + |
| 908 | +#### update\_lbac\_rules\_for\_datasource |
| 909 | + |
| 910 | +```python |
| 911 | +def update_lbac_rules_for_datasource(uid: str) -> dict |
| 912 | +``` |
| 913 | + |
| 914 | +The method includes a functionality to enable the datasource cache specified by the datasource uid |
| 915 | + |
| 916 | +**Arguments**: |
| 917 | + |
| 918 | +- `uid` _str_ - Specify the uid of the datasource |
| 919 | + |
| 920 | + Required Permissions: |
| 921 | +- `Action` - datasources:write, datasources.permissions:write |
| 922 | +- `Scope` - [datasources:*, datasources:uid:*, datasources:uid:<id>] |
| 923 | + |
| 924 | + |
| 925 | +**Raises**: |
| 926 | + |
| 927 | +- `ValueError` - Missed specifying a necessary value |
| 928 | +- `Exception` - Unspecified error by executing the API call |
| 929 | + |
| 930 | + |
| 931 | +**Returns**: |
| 932 | + |
| 933 | +- `api_call` _dict_ - Returns a datasource |
| 934 | + |
0 commit comments