|
18 | 18 | * [get\_datasource\_permissions](#datasource.Datasource.get_datasource_permissions)
|
19 | 19 | * [add\_datasource\_permissions](#datasource.Datasource.add_datasource_permissions)
|
20 | 20 | * [delete\_datasource\_permissions](#datasource.Datasource.delete_datasource_permissions)
|
| 21 | + * [DatasourceQueryResourceCaching](#datasource.DatasourceQueryResourceCaching) |
| 22 | + * [get\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.get_datasource_cache) |
| 23 | + * [enable\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.enable_datasource_cache) |
| 24 | + * [disable\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.disable_datasource_cache) |
| 25 | + * [clean\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.clean_datasource_cache) |
| 26 | + * [update\_datasource\_cache](#datasource.DatasourceQueryResourceCaching.update_datasource_cache) |
21 | 27 |
|
22 | 28 | <a id="datasource"></a>
|
23 | 29 |
|
@@ -504,3 +510,171 @@ The method includes a functionality to delete datasource permission specified by
|
504 | 510 |
|
505 | 511 | None
|
506 | 512 |
|
| 513 | +<a id="datasource.DatasourceQueryResourceCaching"></a> |
| 514 | + |
| 515 | +## DatasourceQueryResourceCaching Objects |
| 516 | + |
| 517 | +```python |
| 518 | +class DatasourceQueryResourceCaching() |
| 519 | +``` |
| 520 | + |
| 521 | +The class includes all necessary methods to access the Grafana datasource query and resource caching 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 ENTERPRISE feature |
| 522 | + |
| 523 | +HINT: Note Grafana Enterprise API need required permissions if fine-grained access control is enabled |
| 524 | + |
| 525 | +**Arguments**: |
| 526 | + |
| 527 | +- `grafana_api_model` _APIModel_ - Inject a Grafana API model object that includes all necessary values and information |
| 528 | + |
| 529 | + |
| 530 | +**Attributes**: |
| 531 | + |
| 532 | +- `grafana_api_model` _APIModel_ - This is where we store the grafana_api_model |
| 533 | + |
| 534 | +<a id="datasource.DatasourceQueryResourceCaching.get_datasource_cache"></a> |
| 535 | + |
| 536 | +#### get\_datasource\_cache |
| 537 | + |
| 538 | +```python |
| 539 | +def get_datasource_cache(uid: str) -> dict |
| 540 | +``` |
| 541 | + |
| 542 | +The method includes a functionality to get the datasource cache config specified by the datasource uid |
| 543 | + |
| 544 | +**Arguments**: |
| 545 | + |
| 546 | +- `uid` _str_ - Specify the uid of the datasource |
| 547 | + |
| 548 | + Required Permissions: |
| 549 | +- `Action` - datasources.caching:write |
| 550 | +- `Scope` - datasources:* |
| 551 | + |
| 552 | + |
| 553 | +**Raises**: |
| 554 | + |
| 555 | +- `ValueError` - Missed specifying a necessary value |
| 556 | +- `Exception` - Unspecified error by executing the API call |
| 557 | + |
| 558 | + |
| 559 | +**Returns**: |
| 560 | + |
| 561 | +- `api_call` _dict_ - Returns a datasource |
| 562 | + |
| 563 | +<a id="datasource.DatasourceQueryResourceCaching.enable_datasource_cache"></a> |
| 564 | + |
| 565 | +#### enable\_datasource\_cache |
| 566 | + |
| 567 | +```python |
| 568 | +def enable_datasource_cache(uid: str) -> dict |
| 569 | +``` |
| 570 | + |
| 571 | +The method includes a functionality to enable the datasource cache specified by the datasource uid |
| 572 | + |
| 573 | +**Arguments**: |
| 574 | + |
| 575 | +- `uid` _str_ - Specify the uid of the datasource |
| 576 | + |
| 577 | + Required Permissions: |
| 578 | +- `Action` - datasources.caching:read |
| 579 | +- `Scope` - datasources:* |
| 580 | + |
| 581 | + |
| 582 | +**Raises**: |
| 583 | + |
| 584 | +- `ValueError` - Missed specifying a necessary value |
| 585 | +- `Exception` - Unspecified error by executing the API call |
| 586 | + |
| 587 | + |
| 588 | +**Returns**: |
| 589 | + |
| 590 | +- `api_call` _dict_ - Returns a datasource |
| 591 | + |
| 592 | +<a id="datasource.DatasourceQueryResourceCaching.disable_datasource_cache"></a> |
| 593 | + |
| 594 | +#### disable\_datasource\_cache |
| 595 | + |
| 596 | +```python |
| 597 | +def disable_datasource_cache(uid: str) -> dict |
| 598 | +``` |
| 599 | + |
| 600 | +The method includes a functionality to disable the datasource cache specified by the datasource uid |
| 601 | + |
| 602 | +**Arguments**: |
| 603 | + |
| 604 | +- `uid` _str_ - Specify the uid of the datasource |
| 605 | + |
| 606 | + Required Permissions: |
| 607 | +- `Action` - datasources.caching:write |
| 608 | +- `Scope` - datasources:* |
| 609 | + |
| 610 | + |
| 611 | +**Raises**: |
| 612 | + |
| 613 | +- `ValueError` - Missed specifying a necessary value |
| 614 | +- `Exception` - Unspecified error by executing the API call |
| 615 | + |
| 616 | + |
| 617 | +**Returns**: |
| 618 | + |
| 619 | +- `api_call` _dict_ - Returns a datasource |
| 620 | + |
| 621 | +<a id="datasource.DatasourceQueryResourceCaching.clean_datasource_cache"></a> |
| 622 | + |
| 623 | +#### clean\_datasource\_cache |
| 624 | + |
| 625 | +```python |
| 626 | +def clean_datasource_cache(uid: str) -> dict |
| 627 | +``` |
| 628 | + |
| 629 | +The method includes a functionality to clean the datasource cache of all data sources with caching enabled. The uid of the datasource will only be used to return the configuration for that data source |
| 630 | + |
| 631 | +**Arguments**: |
| 632 | + |
| 633 | +- `uid` _str_ - Specify the uid of the datasource |
| 634 | + |
| 635 | + Required Permissions: |
| 636 | +- `Action` - datasources.caching:write |
| 637 | +- `Scope` - datasources:* |
| 638 | + |
| 639 | + |
| 640 | +**Raises**: |
| 641 | + |
| 642 | +- `ValueError` - Missed specifying a necessary value |
| 643 | +- `Exception` - Unspecified error by executing the API call |
| 644 | + |
| 645 | + |
| 646 | +**Returns**: |
| 647 | + |
| 648 | +- `api_call` _dict_ - Returns a datasource |
| 649 | + |
| 650 | +<a id="datasource.DatasourceQueryResourceCaching.update_datasource_cache"></a> |
| 651 | + |
| 652 | +#### update\_datasource\_cache |
| 653 | + |
| 654 | +```python |
| 655 | +def update_datasource_cache(uid: str, |
| 656 | + datasource_cache: DatasourceCache) -> dict |
| 657 | +``` |
| 658 | + |
| 659 | +The method includes a functionality to update the datasource cache specified by the datasource uid |
| 660 | + |
| 661 | +**Arguments**: |
| 662 | + |
| 663 | +- `uid` _str_ - Specify the uid of the datasource |
| 664 | +- `datasource_cache` _DatasourceCache_ - Specif the datasource cache object |
| 665 | + |
| 666 | + Required Permissions: |
| 667 | +- `Action` - datasources.caching:write |
| 668 | +- `Scope` - datasources:* |
| 669 | + |
| 670 | + |
| 671 | +**Raises**: |
| 672 | + |
| 673 | +- `ValueError` - Missed specifying a necessary value |
| 674 | +- `Exception` - Unspecified error by executing the API call |
| 675 | + |
| 676 | + |
| 677 | +**Returns**: |
| 678 | + |
| 679 | +- `api_call` _dict_ - Returns a datasource |
| 680 | + |
0 commit comments