lce_service.sl1_models module
- class lce_service.sl1_models.AlertObject(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, app_id: int | None = None, app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, state: EnabledToggle = EnabledToggle.DISABLED, name: Annotated[str, MinLen(min_length=1), MaxLen(max_length=128)], formula: Annotated[str, MinLen(min_length=1), MaxLen(max_length=512)], log_message: Annotated[str, MinLen(min_length=1), MaxLen(max_length=128)], maintain_state: EnabledToggle = EnabledToggle.DISABLED, triggered_alert_id: int = 0, triggered_alert_reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None)
Bases:
DynamicAppEntityDefines the alerts owned by a Dynamic Application. Maps to table: dynamic_app_alerts
- app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- app_id: int | None
- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules an Alert Object must satisfy to be created or updated.
a triggered_alert_id must not be the Alert Object itself, and must be an Alert Object of the same Dynamic Application with maintain_state enabled
Validated while updating (see update_entities), after the Alert Objects are written:
formula references must be Collection Objects (o_<id>), Threshold Objects (t_<id>) or Alert Objects (a_<id>) of its Dynamic Application
a triggered_alert_reference must reference an Alert Object provided in the same request, and the resolved triggered alert must satisfy the triggered_alert_id rules above
- Parameters:
dbc – A silo_cursor instance (unused, the Dynamic Application provides the alerts).
dynamic_app – The complete Dynamic Application the Alert Object belongs to.
- Raises:
InvalidResourceError – Raised when the Alert Object violates a rule.
ValueError – Raised when no Dynamic Application is provided.
- formula: str
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- id: int | None
- log_message: str
- maintain_state: EnabledToggle
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- set_reference()
- set_triggered_alert_reference()
- state: EnabledToggle
- triggered_alert_id: int
- triggered_alert_reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- class lce_service.sl1_models.ApplicationType(*values)
Bases:
FlexibleIntEnum- BULK_SNIPPET_CONFIGURATION = 25
- BULK_SNIPPET_PERFORMANCE = 24
- CPU = 12
- DATABASE_CONFIGURATION = 9
- DATABASE_PERFORMANCE = 8
- INTERNAL_COLLECTION_INVENTORY = 26
- INTERNAL_COLLECTION_PERFORMANCE = 27
- IT_SERVICE = 21
- MEMORY = 13
- POWERSHELL_CONFIG = 23
- POWERSHELL_PERFORMANCE = 22
- SNIPPET_CONFIGURATION = 15
- SNIPPET_JOURNAL = 20
- SNIPPET_PERFORMANCE = 14
- SNMP_CONFIGURATION = 1
- SNMP_PERFORMANCE = 0
- SOAP_CONFIGURATION = 11
- SOAP_PERFORMANCE = 10
- TRAP = 2
- WMI_CONFIG = 19
- WMI_PERFORMANCE = 18
- XML_CONFIGURATION = 5
- XML_PERFORMANCE = 4
- XSLT_CONFIG = 17
- XSLT_PERFORMANCE = 16
- class lce_service.sl1_models.CollectionObject(*, reference: ~typing.Annotated[str | None, ~annotated_types.MinLen(min_length=1), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, app_id: int | None = None, app_guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, name: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1), ~annotated_types.MaxLen(max_length=64)], description: str = '', class_type: ~lce_service.sl1_models.CollectionObjectClass = CollectionObjectClass.UNKNOWN, snippet_id: int = 0, snippet_reference: ~typing.Annotated[str | None, ~annotated_types.MinLen(min_length=1), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, snippet_argument: str = '', formula: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=512)] = '', group: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=50)] = 0, use_array_group: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, group_indexing_enabled: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, component_identifiers: ~typing.List[~lce_service.sl1_models.ComponentIdentifier] = <factory>, disable_maintenance: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, usage_type: ~lce_service.sl1_models.CollectionObjectUsage = CollectionObjectUsage.STANDARD, hide_object: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, change_alerting: ~lce_service.sl1_models.EnabledToggle = EnabledToggle.DISABLED, enable_deviation_alerting: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, min_weeks_data: int = 0, max_weeks_data: int = 0, asset_link: ~lce_service.sl1_models.AssetLink = AssetLink.NONE, asset_link_precedence: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=100)] = 50, table_alignment: ~lce_service.sl1_models.TableAlignment = TableAlignment.LEFT, string_type: ~lce_service.sl1_models.ConfigStringType = ConfigStringType.STANDARD, enum_values: str = '', tabular: ~lce_service.sl1_models.EnabledToggle = EnabledToggle.DISABLED, alignment_condition: ~lce_service.sl1_models.DiscoveryAlignmentCondition = DiscoveryAlignmentCondition.IF_OID_PRESENT, validity_check_pattern: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=128)] = '', validity_check_operator: ~lce_service.sl1_models.DiscoveryOperator = DiscoveryOperator.IS_GREATER_THAN_RESULT)
Bases:
DynamicAppEntityDefines a single data point or metric that the Dynamic Application will collect. Maps to table: dynamic_app_objects
- alignment_condition: DiscoveryAlignmentCondition
- app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- app_id: int | None
- asset_link: AssetLink
- asset_link_precedence: int
- change_alerting: EnabledToggle
- class_type: CollectionObjectClass
- component_identifiers: List[ComponentIdentifier]
- description: str
- disable_maintenance: BooleanToggle
- enable_deviation_alerting: BooleanToggle
- enum_values: str
- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules a Collection Object must satisfy to be created or updated.
Rules for the resulting state of the Collection Object:
class_type must be allowed for the type of its Dynamic Application
asset_link must be allowed in configuration Dynamic Applications
asset_link_precedence must be in increments of 10
component_identifiers must be unique
a snippet_id must be a Snippet of its Dynamic Application
Rules for the fields provided by the user (see validate_provided_fields):
configuration only fields cannot be provided in performance Dynamic Applications, and performance only fields cannot be provided in configuration applications
discovery objects can only be provided discovery related fields, validity check fields cannot be provided when the alignment condition is IF_OID_NOT_PRESENT, and a NO_VALIDITY_CHECK validity_check_operator cannot be provided with an IF_OID_PRESENT alignment_condition
discovery only fields can only be provided for discovery objects
enum objects can only be provided enum related fields, and enum only fields can only be provided for enum objects
component_identifiers can only be provided when the Dynamic Application has component mapping enabled
Validated while updating (see update_entities):
a snippet_reference must reference a Snippet provided in the same request
identity and relationship namespace objects need a group with an index that is not already used by another namespace object
Component identifiers must also be unique across the Collection Objects of the Dynamic Application, which is validated by DynamicApp.execute_strict_validation.
- Parameters:
dbc – A silo_cursor instance used to look up the Snippet.
dynamic_app – The Dynamic Application the Collection Object belongs to.
- Raises:
InvalidResourceError – Raised when the Collection Object violates a rule.
ValueError – Raised when no Dynamic Application is provided.
- formula: str
- get_inapplicable_fields(dynamic_app: DynamicApp | None = None) frozenset[str]
Get the fields that do not apply to this Collection Object in its Dynamic Application.
These are the fields validate_provided_fields rejects when they are provided.
- Parameters:
dynamic_app – The Dynamic Application the Collection Object belongs to. Without it, no field is known not to apply.
- Returns:
The names of the fields that do not apply to the Collection Object.
- group: int
- group_indexing_enabled: BooleanToggle
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- hide_object: BooleanToggle
- id: int | None
- property is_discovery_object: bool
Check if this collection object is a discovery object.
This property determines whether the collection object is configured for discovery purposes by checking if its class type is set to DISCOVERY. Discovery objects are special collection objects used during device discovery processes to identify and validate device capabilities.
- Returns:
True if the collection object’s class_type is DISCOVERY, False otherwise.
- property is_enum_object: bool
Check if this collection object is an enum object.
This property determines whether the collection object is configured for enum purposes by checking if its class type is set to CONFIG_ENUM.
- Returns:
True if the collection object’s class_type is CONFIG_ENUM, False otherwise.
- max_weeks_data: int
- min_weeks_data: int
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- classmethod set_default_discovery_object_name(data: Any) Any
Name discovery objects that are created without a name.
Discovery objects are always named “Discovery Object” (see set_derived_collection_object_fields in update_entities), so a name is only required for the other Collection Objects.
- Parameters:
data – The input data of the model.
- Returns:
The input data, with the name of a discovery object set when missing.
- set_reference()
- set_snippet_reference()
- snippet_argument: str
- snippet_id: int
- snippet_reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- string_type: ConfigStringType
- table_alignment: TableAlignment
- tabular: EnabledToggle
- usage_type: CollectionObjectUsage
- use_array_group: BooleanToggle
- validate_provided_configuration_fields(provided: frozenset[str], header: str) None
Validate the fields provided for a Collection Object of a configuration application.
discovery objects can only be provided discovery related fields, and discovery only fields can only be provided for discovery objects (see validate_provided_discovery_fields)
enum objects can only be provided enum related fields, and enum only fields can only be provided for enum objects (see validate_provided_enum_fields)
performance only fields cannot be provided
- Parameters:
provided – The names of the fields provided by the user.
header – The header identifying the Dynamic Application in error messages.
- Raises:
InvalidResourceError – Raised when a provided field does not apply.
- validate_provided_discovery_fields(provided: frozenset[str], header: str) None
Validate the discovery related fields provided for a Collection Object.
discovery objects can only be provided discovery related fields
validity check fields cannot be provided when the alignment condition is IF_OID_NOT_PRESENT
a NO_VALIDITY_CHECK validity_check_operator cannot be provided together with an IF_OID_PRESENT alignment_condition, as NO_VALIDITY_CHECK is how IF_OID_NOT_PRESENT is stored
discovery only fields can only be provided for discovery objects
- Parameters:
provided – The names of the fields provided by the user.
header – The header identifying the Dynamic Application in error messages.
- Raises:
InvalidResourceError – Raised when a provided field does not apply.
- validate_provided_enum_fields(provided: frozenset[str], header: str) None
Validate the enum related fields provided for a Collection Object.
enum objects can only be provided enum related fields
enum only fields can only be provided for enum objects
- Parameters:
provided – The names of the fields provided by the user.
header – The header identifying the Dynamic Application in error messages.
- Raises:
InvalidResourceError – Raised when a provided field does not apply.
- validate_provided_fields(dynamic_app: DynamicApp) None
Validate that the fields provided by the user apply to this Collection Object.
configuration only fields cannot be provided in performance Dynamic Applications
in configuration Dynamic Applications, the discovery, enum and performance only field rules apply (see validate_provided_configuration_fields)
component_identifiers can only be provided when the Dynamic Application has component mapping enabled
- Parameters:
dynamic_app – The Dynamic Application the Collection Object belongs to.
- Raises:
InvalidResourceError – Raised when a provided field does not apply.
- validity_check_operator: DiscoveryOperator
- validity_check_pattern: str
- class lce_service.sl1_models.CollectionObjectClass(*values)
Bases:
FlexibleIntEnum- CONFIG_CHARACTER = 10
- CONFIG_DATETIME = 19
- CONFIG_ENUM = 11
- CONFIG_GAUGE = 14
- CONFIG_IP_ADDRESS = 18
- CONFIG_MAC_ADDRESS = 17
- CONFIG_NUMERIC = 15
- CONFIG_TIMESTAMP = 16
- CONFIG_TIMETICKS = 12
- DESCRIPTOR_IF = 106
- DISCOVERY = 100
- ICDA = 33
- INDEX = 105
- INDEX_LABEL = 107
- JOURNAL_CHARACTER = 22
- JOURNAL_DATETIME_CLASS = 30
- JOURNAL_ENUM = 23
- JOURNAL_EPOC = 24
- JOURNAL_GAUGE = 25
- JOURNAL_IP_ADDRESS = 29
- JOURNAL_JSON_ARRAY = 32
- JOURNAL_JSON_OBJECT = 31
- JOURNAL_MAC_ADDRESS = 28
- JOURNAL_NUMERIC = 26
- JOURNAL_TIMESTAMP = 27
- LABEL_ALWAYS_POLLED = 104
- LABEL_CONFIG_GROUP = 108
- LABEL_HOURLY_POLLED = 101
- LABEL_IP_ALWAYS_POLLED = 111
- LABEL_IP_HOURLY_POLLED = 110
- PERFORMANCE_COUNTER = 1
- PERFORMANCE_GAUGE = 4
- PERFORMANCE_KILOBYTE = 3
- PERFORMANCE_PERCENT = 2
- SOAP_SESSION = 109
- UNICODE = 21
- UNKNOWN = 0
- XXX = 20
- class lce_service.sl1_models.CollectionObjectUsage(*values)
Bases:
FlexibleIntEnum- GROUP_INDEX = 1
- GUID_PLUS_INDEX = 6
- GUID_RELATIONSHIP = 4
- IDENTITY_NAMESPACE = 2
- RELATIONSHIP_NAMESPACE = 3
- STANDARD = 0
- UNIQUE_IDENTIFIER_PLUS_INDEX = 7
- UNIQUE_IDENTIFIER_RELATIONSHIP = 5
- class lce_service.sl1_models.ComponentIdentifier(*values)
Bases:
FlexibleIntEnum- AVAILABILITY = 8
- CLASS_IDENTIFIER_1 = 3
- CLASS_IDENTIFIER_2 = 4
- DEVICE_NAME = 5
- DISTINGUISHED_NAME = 2
- GUID = 9
- IP_ADDRESS = 12
- MAC_ADDRESS = 6
- ORGANIZATION = 10
- PREVIOUS_UNIQUE_IDS = 11
- UNIQUE_IDENTIFIER = 1
- UNKNOWN = 0
- UUID = 7
- class lce_service.sl1_models.DiscoveryAlignmentCondition(*values)
Bases:
FlexibleIntEnum- IF_OID_NOT_PRESENT = 1
- IF_OID_PRESENT = 0
- class lce_service.sl1_models.DiscoveryOperator(*values)
Bases:
FlexibleIntEnum- IS_EQUAL_TO_RESULT = 2
- IS_GREATER_THAN_RESULT = 1
- IS_LESS_THAN_RESULT = 3
- IS_LIKE = 5
- IS_NOT_EQUAL_TO_RESULT = 4
- MATCHES_REGEX = 6
- NO_VALIDITY_CHECK = 9
- UNSET = 0
- class lce_service.sl1_models.DynamicApp(*, reference: ~typing.Annotated[str | None, ~annotated_types.MinLen(min_length=1), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, pp_guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, name: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1), ~annotated_types.MaxLen(max_length=64)], type: ~lce_service.sl1_models.ApplicationType = ApplicationType.SNIPPET_CONFIGURATION, is_sf_app_type: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, abandon_collection_limit: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=0), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_integer, json_schema_input_type=PydanticUndefined)] = 0, max_devices: ~typing.Annotated[int, ~annotated_types.Ge(ge=1)] = 50, version: ~typing.Annotated[float, ~annotated_types.Ge(ge=0.1)] = 1.0, state: ~lce_service.sl1_models.EnabledToggle = EnabledToggle.ENABLED, poll_interval: ~lce_service.sl1_models.PollInterval = PollInterval.EVERY_15_MINUTES, cu_affinity: ~lce_service.sl1_models.CUAffinity = CUAffinity.ASSIGNED_COLLECTOR, execution_environment: ~typing.Annotated[str | None, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_execution_environment_guid, json_schema_input_type=PydanticUndefined)] = 'sl1_default_ee', execution_environment_type: ~lce_service.sl1_models.ExecutionEnvironmentType = ExecutionEnvironmentType.PYTHON3_LTS, component_mapping: ~lce_service.sl1_models.EnabledToggle = EnabledToggle.DISABLED, component_mapping_dynamic_applications: ~typing.List[str] = <factory>, description: str = '', disable_rollup_of_data: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, release_notes: str = '', null_row_option: ~lce_service.sl1_models.MissingTableDataOption = MissingTableDataOption.DASH_VALUES, null_column_option: ~lce_service.sl1_models.MissingTableDataOption = MissingTableDataOption.DASH_VALUES, collection_objects: ~typing.List[~lce_service.sl1_models.CollectionObject] = <factory>, snippets: ~typing.List[~lce_service.sl1_models.Snippet] = <factory>, presentation_objects: ~typing.List[~lce_service.sl1_models.PresentationObject] = <factory>, threshold_objects: ~typing.List[~lce_service.sl1_models.ThresholdObject] = <factory>, alert_objects: ~typing.List[~lce_service.sl1_models.AlertObject] = <factory>, event_policies: ~typing.List[~lce_service.sl1_models.EventPolicy] = <factory>)
Bases:
EnumLabelMixinSnippet Framework focused schema for a Dynamic Application. Maps to table: dynamic_app
- STORED_REQUIRED_VALID_FIELDS: ClassVar[frozenset[str]] = frozenset({'is_sf_app_type', 'type'})
- abandon_collection_limit: Annotated[int | None, BeforeValidator(func=validate_optional_integer, json_schema_input_type=PydanticUndefined)]
- alert_objects: List[AlertObject]
- property child_entities: List[EnumLabelMixin]
Get all of the child entities of the Dynamic Application.
- Returns:
The Snippets, Collection Objects, Presentation Objects, Threshold Objects, Alert Objects and Event Policies of the Dynamic Application.
- collection_objects: List[CollectionObject]
- component_mapping: EnabledToggle
- component_mapping_dynamic_applications: List[str]
- cu_affinity: CUAffinity
- description: str
- disable_rollup_of_data: BooleanToggle
- discard_inapplicable_validation_errors(dynamic_app: DynamicApp | None = None) None
Discard the validation errors of the fields that do not apply to the Dynamic Application and to each of its child entities (see EnumLabelMixin.get_inapplicable_fields).
Presentation Objects do not apply to configuration Dynamic Applications, so all of their validation errors are discarded.
- Parameters:
dynamic_app – Unused, a Dynamic Application has no parent.
- event_policies: List[EventPolicy]
- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules a Dynamic Application and its child entities must satisfy to be created or updated.
This method must be called on the complete resulting state of the Dynamic Application: the entities provided in the request and all of its stored child entities (see retrieve_entities.get_complete_dynamic_app). Every rule is validated against that complete state, including the stored child entities that are not in the request, so an update is only accepted when the whole resulting Dynamic Application is valid.
Rules for the resulting state of the Dynamic Application:
max_devices cannot be greater than 500 unless using the Snippet Framework app type
the execution_environment must exist
the pp_guid, when set, must be an existing PowerPack
Rules spanning the Dynamic Application and its children:
GUIDs and references must be unique across the Dynamic Application and its children
when component mapping is enabled, a component identifier cannot be used by more than one Collection Object
Rules for the fields provided by the user:
component_mapping_dynamic_applications cannot be provided with entries when component mapping is disabled
Validated on every model construction, as they define the supported Dynamic Applications:
the Snippet Framework app type and the application type must be compatible
Validated while updating (see update_entities):
the type of an existing Dynamic Application cannot be changed
component_mapping_dynamic_applications must reference existing Dynamic Applications or Dynamic Applications provided in the same request, other than itself
The child entities (Snippets, Collection Objects, Presentation Objects, Threshold Objects, Alert Objects and Event Policies) are validated by their own execute_strict_validation.
- Parameters:
dbc – A silo_cursor instance used for the rules that depend on stored data.
dynamic_app – Unused, a Dynamic Application has no parent.
- Raises:
InvalidResourceError – Raised when the Dynamic Application or a child entity violates a rule.
- execution_environment: Annotated[str | None, BeforeValidator(func=validate_execution_environment_guid, json_schema_input_type=PydanticUndefined)]
- execution_environment_type: ExecutionEnvironmentType
- static get_duplicate_component_identifier_names(duplicate_identifiers: Dict[ComponentIdentifier, Set[int | None]]) List[str]
Generate human-readable names for duplicate component identifiers.
This static method processes a dictionary of duplicate component identifiers and their associated collection object IDs to create descriptive names for error reporting. For each duplicate component identifier, it formats the name to include the component identifier name and optionally the collection object references (formatted as “o_{id}”) when all collection objects in the duplicate set have valid IDs.
- Parameters:
duplicate_identifiers – A dictionary mapping ComponentIdentifier enum values to sets of collection object IDs (int or None) where each component identifier appears multiple times. The IDs represent the collection objects that contain the duplicate component identifier. None values indicate collection objects without assigned IDs (typically new objects).
- Returns:
A list of formatted strings describing each duplicate component identifier. Each string contains the component identifier name and optionally includes a parenthetical list of collection object references (e.g., “o_123, o_456”) when all associated collection objects have valid IDs. If any collection object lacks an ID, only the component identifier name is included without the reference list.
- get_inapplicable_fields(dynamic_app: DynamicApp | None = None) frozenset[str]
Get the fields that do not apply to the Dynamic Application.
- Parameters:
dynamic_app – Unused, a Dynamic Application has no parent.
- Returns:
component_mapping_dynamic_applications when component mapping is disabled.
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- id: int | None
- property is_performance_application: bool
Whether this Dynamic Application is a performance type.
- Returns:
True if the application type is SNIPPET_PERFORMANCE or BULK_SNIPPET_PERFORMANCE, False otherwise.
- is_sf_app_type: BooleanToggle
- max_devices: int
- property message_header: str
Get the header identifying the Dynamic Application in error messages.
- Returns:
The name, ID and GUID of the Dynamic Application. A new Dynamic Application has no ID or GUID yet, so it is identified by its name only.
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- null_column_option: MissingTableDataOption
- null_row_option: MissingTableDataOption
- poll_interval: PollInterval
- pp_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- presentation_objects: List[PresentationObject]
- release_notes: str
- set_default_collection_object_class_types()
Set the default class type of Collection Objects without a class type.
Collection Objects with an UNKNOWN class type default to PERFORMANCE_COUNTER in performance applications and CONFIG_CHARACTER in configuration applications.
- Returns:
The DynamicApp instance.
- state: EnabledToggle
- threshold_objects: List[ThresholdObject]
- type: ApplicationType
- validate_snippet_framework_app_type()
Validate that Snippet Framework settings align with the application type. This validator ensures consistency between the is_sf_app_type flag and the application type. When is_sf_app_type is enabled, the application type must be SNIPPET_PERFORMANCE or SNIPPET_CONFIGURATION. When disabled, the application type must be one of the allowed Snippet Framework types (SNIPPET_PERFORMANCE, SNIPPET_CONFIGURATION, BULK_SNIPPET_PERFORMANCE, or BULK_SNIPPET_CONFIGURATION). :return: The validated DynamicApp instance if the Snippet Framework settings
are consistent with the application type.
- Raises:
ValueError – If is_sf_app_type is TRUE but the application type is not SNIPPET_PERFORMANCE or SNIPPET_CONFIGURATION, or if is_sf_app_type is FALSE but the application type is not one of the allowed Snippet Framework types. The error message includes the current application type.
- validate_unique_component_identifiers() None
Validate that no component identifier is used by more than one Collection Object.
This method must be called on the complete state of the Dynamic Application (all of its Collection Objects, see execute_strict_validation), so the Collection Objects of the request are compared with the stored ones.
- Raises:
InvalidResourceError – Raised when a component identifier is used by more than one Collection Object.
- version: float
- class lce_service.sl1_models.DynamicAppEntity(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False)
Bases:
EnumLabelMixin- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules every Dynamic Application entity must satisfy to be created or updated.
the entity’s GUID and the GUID of its Dynamic Application (app_guid) must differ
Subclasses overriding this method must call it.
- Parameters:
dbc – A silo_cursor instance (unused, no stored data is needed).
dynamic_app – The Dynamic Application the entity belongs to, if any.
- Raises:
InvalidResourceError – Raised when the entity violates a rule.
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- class lce_service.sl1_models.DynamicAppUpdateResult(*, dynamic_app: EntityIdentifier = None, snippets: List[EntityIdentifier] = <factory>, collection_objects: List[EntityIdentifier] = <factory>, presentation_objects: List[EntityIdentifier] = <factory>, threshold_objects: List[EntityIdentifier] = <factory>, alert_objects: List[EntityIdentifier] = <factory>, event_policies: List[EntityIdentifier] = <factory>)
Bases:
BaseModel- alert_objects: List[EntityIdentifier]
- collection_objects: List[EntityIdentifier]
- dynamic_app: EntityIdentifier
- event_policies: List[EntityIdentifier]
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- presentation_objects: List[EntityIdentifier]
- snippets: List[EntityIdentifier]
- threshold_objects: List[EntityIdentifier]
- class lce_service.sl1_models.EnabledToggle(*values)
Bases:
FlexibleIntEnum- DISABLED = 0
- ENABLED = 1
- class lce_service.sl1_models.EntityIdentifier(*, id: int, guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)], name: str, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, new: bool = False)
Bases:
BaseModel- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)]
- id: int
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- new: bool
- reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- class lce_service.sl1_models.EntityModelInformation(*, column_mapping: Dict[str, str], immutable_fields: frozenset[str], locked_fields: frozenset[str], entity_identifier_column_mapping: Dict[str, str], insertable_fields_column_mapping: Dict[str, str], primary_db_key: str, app_guid_key: str)
Bases:
BaseModel- app_guid_key: str
- column_mapping: Dict[str, str]
- entity_identifier_column_mapping: Dict[str, str]
- immutable_fields: frozenset[str]
- insertable_fields_column_mapping: Dict[str, str]
- locked_fields: frozenset[str]
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- primary_db_key: str
- class lce_service.sl1_models.EnumLabelMixin(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False)
Bases:
BaseModel- STORED_REQUIRED_VALID_FIELDS: ClassVar[frozenset[str]] = frozenset({})
- add_validation_errors(data: Dict[str, Any]) Dict[str, Any]
Add the validation errors of the entity, if any, to its serialized data.
- Parameters:
data – The serialized data of the entity.
- Returns:
The serialized data, with a validation_errors entry (the field and message of each problem) when there are problems.
- default_reference_set: bool
- discard_inapplicable_validation_errors(dynamic_app: DynamicApp | None = None) None
Discard the validation errors of the fields that do not apply to the entity.
- Parameters:
dynamic_app – The Dynamic Application the entity belongs to, if any.
- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules an entity must satisfy to be created or updated.
Model construction only validates the structure of an entity (types, enums, lengths). The stricter rules required to create or update an entity are validated by this method, which must be called on the complete resulting state of the entity (its stored values updated with the values of the request) before any of it is written. Every rule is validated, whether or not the request provides the fields of the rule, so an update is only accepted when the complete resulting entity is valid.
Each entity type overrides this method; its docstring lists all of the rules for the entity type, including the rules that can only be validated while updating because they depend on identifiers generated during the update. This method only validates: it never modifies the entity or writes to the database.
- Parameters:
dbc – A silo_cursor instance used for the rules that depend on stored data.
dynamic_app – The Dynamic Application the entity belongs to, for child entities.
- Raises:
InvalidResourceError – Raised when the entity violates a rule.
DatabaseExecutionError – Raised when a database lookup fails.
- property fields_to_write: frozenset[str]
Get the names of the fields to write when updating the entity in the database.
For an existing entity built from a request payload, these are the fields provided by the user and the fields whose value differs from the stored value (e.g. fields derived or resolved while updating). Unchanged stored values are not rewritten.
- Returns:
The fields to write. For models without recorded stored values, the fields set on the model (model_fields_set) are returned.
- classmethod get_db_column_mapping() Dict[str, str]
Get a mapping of model field names to their corresponding database column names.
This class method iterates through all fields defined in the Pydantic model and extracts the database column name from each field’s metadata (if present). It builds and returns a dictionary that maps the model’s field names to their corresponding database column names as defined in the field’s json_schema_extra metadata via the define_db_field() helper function.
- Returns:
A dictionary where keys are the model’s field names (as used in Python code) and values are the corresponding database column names (as used in the database). Only fields that have a ‘db_column_name’ defined in their metadata are included in the returned mapping.
- classmethod get_entity_identifier_columns(db_mapping: Dict[str, str]) Dict[str, str]
Get a mapping of entity identifier field names to their database column names.
This class method filters the provided database mapping dictionary to include only those fields that are defined as entity identifier columns. Entity identifier columns are the core fields used to uniquely identify and reference entities in the database, typically including fields like ‘id’ and ‘guid’ that are marked as frozen/immutable.
- Parameters:
db_mapping – A dictionary mapping model field names to their corresponding database column names. This is typically obtained from the get_db_column_mapping() method and contains all field-to-column mappings for the model.
- Returns:
A filtered dictionary containing only the entity identifier fields and their corresponding database column names. The keys are model field names that are entity identifiers, and the values are their database column names. Returns an empty dictionary if no entity identifier fields are found in the provided mapping.
- classmethod get_fields_with_attribute(attribute_name: str) frozenset[str]
Get a set of field names that have a specific attribute in their metadata.
This class method iterates through all fields defined in the Pydantic model and identifies fields that have the specified attribute present in their ATTRIBUTES set within the json_schema_extra metadata. This provides a flexible way to query fields based on custom metadata attributes that may be defined using the define_db_field() helper function.
- Parameters:
attribute_name – The name of the attribute to check for in each field’s ATTRIBUTES set within json_schema_extra metadata. The method will look for this attribute name within the ATTRIBUTES set. Common examples might include ‘config_only’, ‘performance_only’, or other custom field attributes.
- Returns:
A set of field names that have the specified attribute in their ATTRIBUTES metadata set. Returns an empty set if no fields have the specified attribute. Only fields with json_schema_extra metadata containing an ATTRIBUTES set that includes the specified attribute are included in the result.
- classmethod get_immutable_fields() frozenset[str]
Get a set of field names that are immutable.
This class method iterates through all fields defined in the Pydantic model and identifies fields that are locked from updates. A field is considered immutable if: 1. It has the frozen attribute set to True (immutable fields), or 2. It has the immutable flag explicitly set to True in its json_schema_extra metadata
Locked fields represent data that should not be modified after initial creation, such as primary keys, unique identifiers, or other immutable attributes.
- Returns:
A set of field names that are locked and cannot be updated. Returns an empty set if no fields are locked. Fields are included if they are either frozen or explicitly marked as immutable in their metadata.
- get_inapplicable_fields(dynamic_app: DynamicApp | None = None) frozenset[str]
Get the fields that do not apply to the entity.
These fields cannot be provided in a request (see execute_strict_validation) and are not part of the entity’s retrieved data, so their stored values have no effect.
- Parameters:
dynamic_app – The Dynamic Application the entity belongs to, if any.
- Returns:
The names of the fields that do not apply to the entity.
- classmethod get_locked_fields() frozenset[str]
Get a set of field names that are marked as frozen (locked).
This class method iterates through all fields defined in the Pydantic model and identifies which fields have the frozen attribute set to True. Frozen fields cannot ever be modified or set even upon initial creation.
- Returns:
A set of field names that are marked as frozen. Returns an empty set if no fields are frozen.
- classmethod get_model_information() EntityModelInformation
Get comprehensive model metadata including database mappings and field constraints.
This class method aggregates various types of model metadata into a single EntityModelInformation object. It collects database column mappings, identifies immutable and frozen fields, extracts entity identifier column mappings, and determines insertable fields. This consolidated information is useful for database operations, validation, and understanding the model’s structure and constraints.
- Returns:
An EntityModelInformation instance containing: - column_mapping: Dictionary mapping model field names to database column names - immutable_fields: Set of field names that cannot be updated after creation - locked_fields: Set of field names that are frozen (cannot be modified) - entity_identifier_column_mapping: Dictionary mapping entity identifier field
names to their corresponding database column names
- insertable_fields_column_mapping: Dictionary mapping non-frozen field names to
their database column names (fields that can be inserted)
primary_db_key: The database column name for the primary key
- app_guid_key: The database column name for the application GUID reference
(defaults to ‘app_guid’)
- property is_default_reference_set: bool
Check if the reference was automatically set for this instance.
- Returns:
True if the reference was automatically generated, False if it was explicitly provided or set manually
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- classmethod model_validate_stored(data: Dict[str, Any], discard_inapplicable: bool = True) Self
Build a model from stored data, keeping the stored values that fail validation.
Stored data is not always valid (e.g. data written outside of this API), and reading it must not fail. When a field fails validation, the model is built with the field’s default (or STORED_VALUE_PLACEHOLDER for a required field), and the stored value is then set as is and reported in validation_errors. The field counts as set, like a validated field. Updating the entity through the API requires fixing those values (see retrieve_entities.get_complete_dynamic_app).
- Parameters:
data – The stored data of the entity, keyed by field name.
discard_inapplicable – Whether the validation errors of the fields that do not apply to the entity are discarded (see discard_inapplicable_validation_errors).
- Returns:
The model of the entity.
- Raises:
ValidationError – Raised when the data fails a rule of the model that is not about a single field, such as the supported application types, or when a field of STORED_REQUIRED_VALID_FIELDS is invalid.
- property provided_fields: frozenset[str]
Get the names of the fields explicitly provided by the user.
Models of existing entities built from a request payload contain the complete state of the entity (stored values updated with the user provided values), so every field is in model_fields_set. The fields the user actually provided are recorded separately with set_provided_fields and are only needed for rules about the user’s request, such as rejecting fields that do not apply to an entity. Unlike model_fields_set, these are not affected by later assignments.
- Returns:
The recorded provided fields. For models whose provided fields were never recorded (e.g. models not built from a request payload), the fields set on the model (model_fields_set) are returned.
- reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- set_provided_fields(fields: Iterable[str]) None
Record the names of the fields explicitly provided by the user.
- Parameters:
fields – The names of the fields provided by the user.
- set_reference()
- set_reference_automatically()
Automatically set the reference label when it’s None during model creation.
This validator runs after all field validation and sets the reference field to a default value if it wasn’t provided. It also tracks whether the reference was automatically set for this specific instance.
- Returns:
The model instance with reference potentially auto-set
- set_stored_values(stored: Dict[str, Any]) None
Record the stored values of the existing entity this model was built from.
The values are normalized the same way as the model’s values (e.g. stripped strings, enums), so fields_to_write only reports fields whose value actually changed.
- Parameters:
stored – The stored values of the entity, keyed by API field name.
- property validation_errors: List[Dict[str, Any]]
Get the problems of the stored values of the entity that fail validation.
- Returns:
The field, message and stored value of each problem (see model_validate_stored). Empty for entities without problems.
- class lce_service.sl1_models.EventPolicy(*, reference: ~typing.Annotated[str | None, ~annotated_types.MinLen(min_length=1), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, app_id: int = 0, app_guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, pp_guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, source: ~lce_service.sl1_models.EventSource = EventSource.DYNAMIC, state: ~lce_service.sl1_models.EnabledToggle = EnabledToggle.ENABLED, severity: ~lce_service.sl1_models.EventSeverity = EventSeverity.MAJOR, use_severity_modifier: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, name: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1), ~annotated_types.MaxLen(max_length=128)], message: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1), ~annotated_types.MaxLen(max_length=255)], description: str = '', occurrence_count: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=1000)] = 0, occurrence_time: ~lce_service.sl1_models.EventTime = EventTime.DISABLED, expiry_delay: ~lce_service.sl1_models.EventTime = EventTime.DISABLED, detection_weight: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=20)] = 0, syslog_facility: ~lce_service.sl1_models.EventSyslogFacility = EventSyslogFacility.MATCH_ANY, syslog_severity: ~lce_service.sl1_models.EventSyslogSeverity = EventSyslogSeverity.MATCH_ANY, syslog_application_name: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=48), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, syslog_process_id: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=128), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, syslog_message_id: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=32), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, source_host_oid: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, trap_oid: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, trap_symbolic: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, link_id: int = 0, link_reference: ~typing.Annotated[str | None, ~annotated_types.MinLen(min_length=1), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, component_type: ~lce_service.sl1_models.EventComponentType = EventComponentType.NOT_ANY, external_event_id: ~typing.Annotated[int | None, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_integer, json_schema_input_type=PydanticUndefined)] = None, external_category: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=255)] = '', topology_suppression: ~lce_service.sl1_models.EventTopologySuppression = EventTopologySuppression.DISABLED, match_logic: ~lce_service.sl1_models.EventMatchLogic = EventMatchLogic.TEXT_SEARCH, use_multi_match: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, use_message_match: ~lce_service.sl1_models.BooleanToggle = BooleanToggle.FALSE, first_match_string: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=512)] = '', second_match_string: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=512)] = '', identifier_pattern: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=512)] = '', override_identifier_type: ~lce_service.sl1_models.EventYType = EventYType.NONE, identifier_format: ~typing.Annotated[str, ~annotated_types.MaxLen(max_length=128)] = '', auto_clear_events: ~typing.List[str] = <factory>)
Bases:
DynamicAppEntityDefines the event policies owned by a Dynamic Application. Maps to table: policies_events
- app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- app_id: int
- auto_clear_events: List[str]
- component_type: EventComponentType
- description: str
- detection_weight: int
- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules an Event Policy must satisfy to be created or updated.
Rules for the resulting state of the Event Policy:
occurrence_count and occurrence_time must be both set or both unset
SYSLOG, API and EMAIL sources require a first_match_string
DYNAMIC and INTERNAL sources require a link_id (in a Dynamic Application, a link_reference to an Alert Object may be provided instead)
INTERNAL sources must link to an internal message or internal alert
TRAP sources require a trap_oid that is a known trap OID or a valid OID pattern, and a source_host_oid, when set, must be a valid OID
DYNAMIC sources must link to an existing Alert Object which, in a Dynamic Application, must belong to that Dynamic Application
in a Dynamic Application, the source must be DYNAMIC
Rules for the fields provided by the user:
only the fields that apply to the source can be provided
Validated while updating (see update_entities):
a link_reference must reference an Alert Object provided in the same request
auto_clear_events must reference existing Event Policies (or Event Policies provided in the same request) other than the Event Policy itself
the pp_guid, when set, must be an existing PowerPack
- Parameters:
dbc – A silo_cursor instance used to look up linked entities.
dynamic_app – The Dynamic Application the Event Policy is provided in, if any.
- Raises:
InvalidResourceError – Raised when the Event Policy violates a rule.
- expiry_delay: EventTime
- external_category: str
- external_event_id: Annotated[int | None, BeforeValidator(func=validate_optional_integer, json_schema_input_type=PydanticUndefined)]
- first_match_string: str
- get_inapplicable_fields(dynamic_app: DynamicApp | None = None) frozenset[str]
Get the fields that do not apply to the source of this Event Policy.
These are the fields execute_strict_validation rejects when they are provided (the source-dependent ones are reset by normalize_event_policies when the Event Policy is written).
- Parameters:
dynamic_app – Unused, the source of the Event Policy determines its fields.
- Returns:
The names of the fields that do not apply to the Event Policy.
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- id: int | None
- identifier_format: str
- identifier_pattern: str
- link_id: int
- link_reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- match_logic: EventMatchLogic
- message: str
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- occurrence_count: int
- occurrence_time: EventTime
- override_identifier_type: EventYType
- pp_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- reference: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- second_match_string: str
- severity: EventSeverity
- source: EventSource
- source_host_oid: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- state: EnabledToggle
- syslog_application_name: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- syslog_facility: EventSyslogFacility
- syslog_message_id: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- syslog_process_id: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- syslog_severity: EventSyslogSeverity
- topology_suppression: EventTopologySuppression
- trap_oid: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- trap_symbolic: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- use_message_match: BooleanToggle
- use_multi_match: BooleanToggle
- use_severity_modifier: BooleanToggle
- validate_dynamic_link(dbc: silo_cursor, description: str, dynamic_app: DynamicApp | None = None) None
Validate the Alert Object a DYNAMIC Event Policy links to.
The complete Dynamic Application has all of its stored Alert Objects, so only links to other Alert Objects are looked up. In a Dynamic Application, the Alert Object must belong to that Dynamic Application. An Event Policy without a link_id is not validated here (a missing link_id is reported by execute_strict_validation).
- Parameters:
dbc – A silo_cursor instance used to look up the Alert Object.
description – The description of the Event Policy used in error messages.
dynamic_app – The Dynamic Application the Event Policy is provided in, if any.
- Raises:
InvalidResourceError – Raised when the linked Alert Object does not exist or belongs to another Dynamic Application.
- validate_linked_entity(dbc: silo_cursor, description: str, dynamic_app: DynamicApp | None = None) None
Validate the entity an Event Policy links to, according to its source.
INTERNAL sources must link to an internal message or internal alert
TRAP sources require valid trap OID fields (see validate_trap_fields)
DYNAMIC sources must link to an existing Alert Object (see validate_dynamic_link)
- Parameters:
dbc – A silo_cursor instance used to look up linked entities.
description – The description of the Event Policy used in error messages.
dynamic_app – The Dynamic Application the Event Policy is provided in, if any.
- Raises:
InvalidResourceError – Raised when the linked entity is invalid.
- validate_trap_fields(dbc: silo_cursor, description: str) None
Validate the trap OID fields of a TRAP Event Policy.
- Parameters:
dbc – A silo_cursor instance used to look up known trap OIDs.
description – The description of the Event Policy used in error messages.
- Raises:
InvalidResourceError – Raised when a trap OID field is invalid.
- class lce_service.sl1_models.EventSource(*values)
Bases:
FlexibleIntEnum- AGENT = 10
- API = 6
- DYNAMIC = 4
- EMAIL = 7
- INTERNAL = 2
- RCR_ACCEPTED = 12
- RCR_CUSTOM = 14
- RCR_SUGGESTION = 13
- SKYLAR = 15
- SYSLOG = 1
- TRAP = 3
- class lce_service.sl1_models.ExecutionEnvironment(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, guid: Annotated[str | None, BeforeValidator(func=validate_execution_environment_guid, json_schema_input_type=PydanticUndefined)], type: ExecutionEnvironmentType)
Bases:
EnumLabelMixinDefines a single Execution Environment. Maps to table: exec_envs
- guid: Annotated[str | None, BeforeValidator(func=validate_execution_environment_guid, json_schema_input_type=PydanticUndefined)]
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- type: ExecutionEnvironmentType
- class lce_service.sl1_models.PowerPack(*, reference: ~typing.Annotated[str | None, ~annotated_types.MinLen(min_length=1), ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~lce_service.sl1_models.validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, name: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1), ~annotated_types.MaxLen(max_length=64)], revision: int = 1, dynamic_applications: ~typing.List[~lce_service.sl1_models.DynamicApp] = <factory>, errors: ~typing.List[str] = <factory>)
Bases:
EnumLabelMixinSnippet Framework focused schema for a PowerPack. Maps to table: powerpack
- dynamic_applications: List[DynamicApp]
- errors: List[str]
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- id: int | None
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- revision: int
- class lce_service.sl1_models.PresentationObject(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, app_id: int | None = None, app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, name: Annotated[str, MinLen(min_length=1), MaxLen(max_length=42)], guide_text: Annotated[str, MaxLen(max_length=2048)] = '', formula: Annotated[str, MaxLen(max_length=512)] = '()', show_as_percent: BooleanToggle = BooleanToggle.FALSE, summarization_state: BooleanToggle = BooleanToggle.FALSE, abbreviation_suffix: Annotated[str, MinLen(min_length=0), MaxLen(max_length=16)] = '', data_unit: Annotated[str, MinLen(min_length=0), MaxLen(max_length=25)] = '')
Bases:
DynamicAppEntityDefines how to display a performance metric that the Dynamic Application collects. Maps to table: dynamic_app_presentation
- abbreviation_suffix: str
- app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- app_id: int | None
- data_unit: str
- execute_strict_validation(dbc: silo_cursor, dynamic_app: DynamicApp | None = None) None
Validate the rules a Presentation Object must satisfy to be created or updated.
its Dynamic Application must be a performance application (stored Presentation Objects of a configuration Dynamic Application do not apply to it and are ignored, see retrieve_entities.get_complete_dynamic_app)
Validated while updating (see update_entities), after references are replaced:
formula references must be Collection Objects (o_<id>) of its Dynamic Application
- Parameters:
dbc – A silo_cursor instance (unused, no stored data is needed).
dynamic_app – The Dynamic Application the Presentation Object belongs to.
- Raises:
InvalidResourceError – Raised when the Presentation Object violates a rule.
ValueError – Raised when no Dynamic Application is provided.
- formula: str
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- guide_text: str
- id: int | None
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- set_reference()
- show_as_percent: BooleanToggle
- summarization_state: BooleanToggle
- class lce_service.sl1_models.Snippet(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, app_id: int | None = None, app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, name: Annotated[str, MinLen(min_length=1), MaxLen(max_length=64)], snippet: str = '', state: EnabledToggle = EnabledToggle.ENABLED, required: RequiredToggle = RequiredToggle.REQUIRED)
Bases:
DynamicAppEntityDefines a reusable script or code block for the Dynamic Application. Maps to table: dynamic_app_requests
- app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- app_id: int | None
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- id: int | None
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- required: RequiredToggle
- set_reference()
- snippet: str
- state: EnabledToggle
- class lce_service.sl1_models.ThresholdObject(*, reference: Annotated[str | None, MinLen(min_length=1), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, default_reference_set: bool = False, id: int | None = None, guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, app_id: int | None = None, app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None = None, name: Annotated[str, MinLen(min_length=1), MaxLen(max_length=64)], override_threshold_value: BooleanToggle = BooleanToggle.TRUE, numeric_range_high: Annotated[float, Ge(ge=0)] = 100.0, numeric_range_low: Annotated[float, Ge(ge=0)] = 0.0, type: ThresholdType = ThresholdType.PERCENTAGE, unit: Annotated[str | None, MinLen(min_length=0), MaxLen(max_length=25), BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)] = None, value: Annotated[float, Ge(ge=0)] = 90.0)
Bases:
DynamicAppEntityDefines the thresholds used for alerts generated by a Dynamic Application. Maps to table: dynamic_app_thresholds
- app_guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- app_id: int | None
- guid: Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)] | None
- id: int | None
- model_config = {'extra': 'forbid', 'str_strip_whitespace': True, 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- name: str
- numeric_range_high: float
- numeric_range_low: float
- override_threshold_value: BooleanToggle
- set_reference()
- type: ThresholdType
- unit: Annotated[str | None, BeforeValidator(func=validate_optional_string, json_schema_input_type=PydanticUndefined)]
- value: float
- class lce_service.sl1_models.User(*, id: int, username: str, organization_id: int, access_hooks: Set[str])
Bases:
BaseModelRepresents a user in the Skylar One system.
This model contains user identification, authentication, and authorization information. All fields are immutable (frozen) to ensure data integrity.
- access_hooks: Set[str]
- has_access_hook(hook: str) bool
Check if the user has a specific access hook.
- Parameters:
hook – The access hook identifier to check for
- Returns:
True if the user has the specified access hook, False otherwise
- id: int
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- organization_id: int
- username: str
- lce_service.sl1_models.validate_guid(v: str) str
Validate that a string conforms to the expected GUID format.
This function ensures that the provided value is a string containing exactly 32 hexadecimal characters (A-F, 0-9) in uppercase. This format is used throughout the SL1 system for unique identifiers.
- Parameters:
v – The value to validate as a GUID. Must be a string containing exactly 32 uppercase hexadecimal characters (A-F, 0-9).
- Returns:
The validated GUID string, unchanged from the input if validation passes.
- Raises:
ValueError – If the value is not a string, or if it doesn’t match the required 32-character uppercase hexadecimal format.