Provides the storage abstraction for Resources.
More...
Provides the storage abstraction for Resources.
- Note
- : A resource id is unique together with source.
def etr.plugins.resources.Storage.__init__ |
( |
|
self, |
|
|
|
db |
|
) |
| |
- Parameters
-
db | Sqlite3 database file (can also be :memory: for in-memory storage). |
def etr.plugins.resources.Storage.add_resource |
( |
|
self, |
|
|
|
source, |
|
|
|
resid, |
|
|
|
name, |
|
|
|
attributes |
|
) |
| |
Add or update a resource uniquely identified by resid
- Parameters
-
source | resource source (e.g. hostname) |
resid | resource id |
name | user provided resource name |
attributes | attributes to store |
def etr.plugins.resources.Storage.get_resource |
( |
|
self, |
|
|
|
name |
|
) |
| |
Get one resource using user provided name for resource.
- Parameters
-
name | resource name Returns `Resource` |
def etr.plugins.resources.Storage.get_resource_names |
( |
|
self, |
|
|
|
List, |
|
|
|
str |
|
) |
| |
Get all resource names.
Returns List of resource names
def etr.plugins.resources.Storage.get_resources |
( |
|
self, |
|
|
|
List, |
|
|
|
Resource |
|
) |
| |
Get all resources.
Returns list of Resource
s: [Resource(source, resid, name, attributes),...]
def etr.plugins.resources.Storage.has_resource_by_id |
( |
|
self, |
|
|
|
source, |
|
|
|
resid |
|
) |
| |
Check if storage has resource in storage.
- Parameters
-
source | resource source |
resid | resource id |
- Returns
- True if storage has resource False otherwise
def etr.plugins.resources.Storage.has_resource_by_name |
( |
|
self, |
|
|
|
name |
|
) |
| |
Check if storage has resource in storage.
- Parameters
-
- Returns
- True if storage has resource False otherwise
def etr.plugins.resources.Storage.remove_resource |
( |
|
self, |
|
|
|
source, |
|
|
|
resid |
|
) |
| |
Remove resource.
- Parameters
-
source | resource source |
resid | resource id |
def etr.plugins.resources.Storage.zeroize |
( |
|
self | ) |
|
Wipe database of all data.
The documentation for this class was generated from the following file:
- INTROOT/lib/python3.7/site-packages/etr/plugins/resources.py