You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
5.7 KiB
119 lines
5.7 KiB
# Copyright (C) 2005-2025 Splunk Inc. All Rights Reserved.
|
|
|
|
from .suite_content import SuiteContent
|
|
|
|
|
|
class UIViews(object):
|
|
"""
|
|
This class defines Python data structures of ITSI UI and their relation to features.
|
|
This class is designed to only implement data definition and simple helper methods
|
|
to construct, read and maintain these data structures.
|
|
Application logic interpreting these data structures should be implemented outside of this class.
|
|
"""
|
|
|
|
# This dictionary maps the views to the features.
|
|
# No need to define the views and the features that are always enabled (never disabled).
|
|
# Here is the list:
|
|
# FEATURE_itsi_backup_restore: {
|
|
# "app_upgrade",
|
|
# "backup_restore_configuration",
|
|
# "backup_restore_lister",
|
|
# "license_upgrade",
|
|
# "partial_backup_details_view",
|
|
# "refresh_queue_explorer",
|
|
# "upgrade_readiness"}
|
|
# FEATURE_itsi_data_integration: {
|
|
# "alerts_connection_configuration",
|
|
# "alerts_connections_lister",
|
|
# "data_integrations"
|
|
# }
|
|
# # service_importer is here because it also handles entity bulk import
|
|
# FEATURE_itsi_entities: {
|
|
# "discovery_search_detail",
|
|
# "entities_lister",
|
|
# "entity_detail",
|
|
# "service_importer"}
|
|
# FEATURE_itsi_infrastructure_overview: {"entity_overview"}
|
|
_FEATURE_VIEWS = {
|
|
SuiteContent.FEATURE_itsi_custom_threshold_windows: {"custom_threshold_windows_lister"},
|
|
SuiteContent.FEATURE_itsi_deep_dive: {"saved_deep_dive_lister",
|
|
"deep_dive"},
|
|
SuiteContent.FEATURE_itsi_drift_detection: {"drift_detection_configuration"},
|
|
SuiteContent.FEATURE_itsi_event_analytics: {"itsi_event_management",
|
|
"event_management_state_lister",
|
|
"event_analytics_audit",
|
|
"event_analytics_monitoring",
|
|
"notable_event_aggregation_policies_lister",
|
|
"notable_event_aggregation_policy_configuration_view",
|
|
"notable_event_aggregation_policy_detail_view",
|
|
"correlation_searches_lister",
|
|
"correlation_search_edit",
|
|
"alarm_console",
|
|
"hybrid_action_dispatching_config",
|
|
"webhooks_lister",
|
|
"webhook_details"},
|
|
SuiteContent.FEATURE_itsi_glass_table: {"glass_tables_lister",
|
|
"glass_table"},
|
|
SuiteContent.FEATURE_itsi_health_analytics_console: {"advanced_configuration", "health_analytics_console"},
|
|
SuiteContent.FEATURE_itsi_maintenance_window: {"maintenance_windows_lister",
|
|
"maintenance_window_detail_view"},
|
|
SuiteContent.FEATURE_itsi_predictive_analytics: {"predictive_analytics_usage"},
|
|
SuiteContent.FEATURE_itsi_service_analyzer: {"homeview",
|
|
"saved_homepage_lister"},
|
|
SuiteContent.FEATURE_itsi_service_monitoring: {"service_definition",
|
|
"service_templates_lister",
|
|
"service_template_detail_view",
|
|
"service_kpi_management",
|
|
"kpi_base_searches_lister",
|
|
"base_search_configuration",
|
|
"kpi_threshold_templates_lister",
|
|
"kpi_threshold_template_editor"},
|
|
SuiteContent.FEATURE_itsi_service_sandbox: {"service_sandbox", "service_sandbox_lister"},
|
|
SuiteContent.FEATURE_itsi_teams: {"teams_lister",
|
|
"team_detail_view"}
|
|
}
|
|
|
|
@staticmethod
|
|
def verify_feature_views_definition():
|
|
# Verify that all restricted features are listed
|
|
features = SuiteContent.get_features_for_suite(SuiteContent.least_permissible_suite())
|
|
restricted_features = set()
|
|
for feature, enabled in features.items():
|
|
if not enabled:
|
|
restricted_features.add(feature)
|
|
|
|
defined_features = set(UIViews._FEATURE_VIEWS.keys())
|
|
assert defined_features.issubset(restricted_features), "defined_features {} is not a subset of {}".format(
|
|
defined_features.difference,
|
|
restricted_features
|
|
)
|
|
|
|
# Verify that view doesn't appear twice
|
|
checked_views = set()
|
|
for feature, views in UIViews._FEATURE_VIEWS.items():
|
|
for view in views:
|
|
assert view not in checked_views, "duplicate view: {}".format(view)
|
|
checked_views.add(view)
|
|
|
|
@staticmethod
|
|
def feature_to_views():
|
|
return UIViews._FEATURE_VIEWS
|
|
|
|
@staticmethod
|
|
def view_to_feature():
|
|
"""
|
|
Returns mapping of UI view to a feature.
|
|
|
|
@rtype: dict
|
|
@return: dict of this form: {view1: feature1, view2: feature1,...,viewN: feature2}
|
|
"""
|
|
|
|
view_to_feature = {}
|
|
for feature, views in UIViews._FEATURE_VIEWS.items():
|
|
for view in views:
|
|
view_to_feature[view] = feature
|
|
return view_to_feature
|
|
|
|
|
|
UIViews.verify_feature_views_definition()
|