lce_service.validation_queries module
- class lce_service.validation_queries.DeviceCategory(id: int, guid: str | None, name: str)
Bases:
NamedTupleA device category a device class belongs to.
- Parameters:
id – The Fid of the category, stored in the family column of a device class.
guid – The family_guid of the category, also stored on its device classes.
name – The name of the category.
- guid: str | None
Alias for field number 1
- id: int
Alias for field number 0
- name: str
Alias for field number 2
- exception lce_service.validation_queries.InvalidResourceError(message: str)
Bases:
AttributeErrorException raised when a resource is found but contains invalid or malformed data.
This error is raised when attempting to validate a resource (such as a Dynamic Application) that exists in the database but fails validation due to invalid data, incorrect format, or constraint violations.
- Parameters:
message – A descriptive error message explaining what validation failed and any relevant details about the invalid data.
- lce_service.validation_queries.execution_environment_exists(dbc: silo_cursor, guid: str, env_types: List[int]) bool
Check whether an Execution Environment of a supported type exists.
- Parameters:
dbc – A silo_cursor instance used to query the master.exec_envs table.
guid – The GUID of the Execution Environment (or sl1_default_ee).
env_types – The supported Execution Environment types (exec_envs.env_type values).
- Returns:
True if the Execution Environment exists with one of the supported types.
- lce_service.validation_queries.find_device_categories(dbc: silo_cursor, field: str, values: List[Any]) List[DeviceCategory]
Find the device categories with one of several ids, GUIDs or names.
- Parameters:
dbc – A silo_cursor instance used to query the master.definitions_dev_cats table.
field – What the values are: “id”, “guid” or “name” (see DEVICE_CATEGORY_COLUMNS).
values – The values to match. No query is executed if empty.
- Returns:
The categories found, ordered by id. Several categories can share a name.
- Raises:
KeyError – Raised when the field is not one of DEVICE_CATEGORY_COLUMNS.
DatabaseExecutionError – Raised when the database query fails.
- lce_service.validation_queries.get_alert_app_id(dbc: silo_cursor, alert_id: int) int | None
Get the ID of the Dynamic Application an Alert Object belongs to.
- Parameters:
dbc – A silo_cursor instance used to query the master.dynamic_app_alerts table.
alert_id – The ID of the Alert Object.
- Returns:
The ID of the Dynamic Application, or None if the Alert Object does not exist.
- lce_service.validation_queries.get_existing_powerpack_guids(dbc: silo_cursor, pp_guids: List[str]) frozenset[str]
Get the PowerPacks of a list that are installed.
- Parameters:
dbc – A silo_cursor instance used to query the master.powerpack table.
pp_guids – The GUIDs of the PowerPacks, in either case. No query is executed if empty.
- Returns:
The uppercase GUIDs of the PowerPacks that are installed.
- Raises:
DatabaseExecutionError – Raised when the database query fails.
- lce_service.validation_queries.get_existing_tier_ids(dbc: silo_cursor, tier_ids: List[int]) frozenset[int]
Get the device class tiers of a list that exist.
- Parameters:
dbc – A silo_cursor instance used to query the master.definitions_dev_class_tiers table.
tier_ids – The ids of the tiers. No query is executed if empty.
- Returns:
The ids of the tiers that exist.
- Raises:
DatabaseExecutionError – Raised when the database query fails.
- lce_service.validation_queries.get_snippet_app_id(dbc: silo_cursor, snippet_id: int) int | None
Get the ID of the Dynamic Application a Snippet belongs to.
- Parameters:
dbc – A silo_cursor instance used to query the master.dynamic_app_requests table.
snippet_id – The ID of the Snippet.
- Returns:
The ID of the Dynamic Application, or None if the Snippet does not exist.
- lce_service.validation_queries.get_trap_oid_symbolic_name(dbc: silo_cursor, trap_oid: str) str | None
Get the symbolic name of a known trap OID.
- Parameters:
dbc – A silo_cursor instance used to query the master.snmp_oid_store table.
trap_oid – The trap OID, which is sanitized before the lookup.
- Returns:
The symbolic name of the trap OID, or None if the trap OID is not known.
- lce_service.validation_queries.internal_link_exists(dbc: silo_cursor, link_id: int) bool
Check whether an internal Event Policy link exists.
Internal Event Policies link to an internal message or an internal alert.
- Parameters:
dbc – A silo_cursor instance used to query the internal messages and alerts tables.
link_id – The link_id of the Event Policy.
- Returns:
True if the link_id is a valid internal message or internal alert ID.
- lce_service.validation_queries.powerpack_exists(dbc: silo_cursor, pp_guid: str) bool
Check whether a PowerPack exists.
- Parameters:
dbc – A silo_cursor instance used to query the master.powerpack table.
pp_guid – The GUID of the PowerPack.
- Returns:
True if the PowerPack exists.
- lce_service.validation_queries.sanitize_trap_oid(trap_oid: str) str
Remove the characters that are not digits or dots from a trap OID.
- Parameters:
trap_oid – The trap OID.
- Returns:
The sanitized trap OID.