hawat.blueprints.events package
This file contains pluggable module for Hawat web interface containing features related to IDEA events, database searching, viewing event details and producing event dashboards.
- class hawat.blueprints.events.APIDashboardView[source]
Bases:
AJAXMixin
,AbstractDashboardView
View responsible for presenting overall IDEA event statistics dashboard in the form of JSON document.
- classmethod get_view_name()[source]
Implementation of
hawat.view.BaseView.get_view_name()
.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.APIMetadataView[source]
Bases:
AJAXMixin
,SimpleView
Application view providing access event metadata information.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
- classmethod get_view_name()[source]
Return unique name for the view. Name must be unique in the namespace of parent blueprint/module and should contain only characters
[a-z0-9]
. It will be used for generating endpoint name for the view.This method does not have any default implementation and must be overridden by a subclass.
- Returns
Name for the view.
- Return type
str
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.APISearchView[source]
Bases:
AJAXMixin
,AbstractSearchView
View responsible for searching the IDEA event database and presenting the results in the form of JSON document.
- classmethod get_view_name()[source]
Implementation of
hawat.view.BaseView.get_view_name()
.
- methods: t.ClassVar[t.Optional[t.Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.APIShowView[source]
Bases:
AJAXMixin
,AbstractShowView
Detailed IDEA event view that presents the result as HTML page.
- classmethod get_view_name()[source]
Implementation of
hawat.view.BaseView.get_view_name()
.
- methods: t.ClassVar[t.Optional[t.Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.AbstractDashboardView[source]
Bases:
SQLAlchemyMixin
,BaseSearchView
Base class for presenting overall IDEA event statistics dashboard.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- static build_query(query, model, form_args)[source]
Hook method. Modify given query according to the given arguments.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
Return menu entry title for the view.
Default implementation returns the return value of
hawat.view.BaseView.get_view_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry title for the view.
- Return type
str
- static get_search_form(request_args)[source]
Must return instance of
flask_wtf.FlaskForm
appropriate for searching given type of items.
- classmethod get_view_template()[source]
Return Jinja2 template file that should be used for rendering the view content. This default implementation works only in case the view class was properly registered into the parent blueprint/module with
hawat.app.hawatBlueprint.register_view_class()
method.- Returns
Jinja2 template file to use to render the view.
- Return type
str
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- class hawat.blueprints.events.AbstractSearchView[source]
Bases:
PsycopgMixin
,BaseSearchView
Base class for all views responsible for searching IDEA event database.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
Return menu entry title for the view.
Default implementation returns the return value of
hawat.view.BaseView.get_view_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry title for the view.
- Return type
str
- static get_search_form(request_args)[source]
Must return instance of
flask_wtf.FlaskForm
appropriate for searching given type of items.
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- class hawat.blueprints.events.AbstractShowView[source]
Bases:
PsycopgMixin
,ItemShowView
Base class responsible for fetching and presenting single IDEA event.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
Implementation of
hawat.view.BaseView.get_menu_title()
.
- classmethod get_view_title(**kwargs)[source]
Implementation of
hawat.view.BaseView.get_view_title()
.
- hawat.blueprints.events.BLUEPRINT_NAME = 'events'
Name of the blueprint as module global constant.
- class hawat.blueprints.events.DashboardView[source]
Bases:
HTMLMixin
,AbstractDashboardView
View responsible for presenting overall IDEA event statistics dashboard in the form of HTML page.
- classmethod get_view_name()[source]
Implementation of
hawat.view.BaseView.get_view_name()
.
- methods: ClassVar[Optional[Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.DownloadView[source]
Bases:
PsycopgMixin
,BaseView
Download IDEA event as JSON file.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- dispatch_request(item_id)[source]
Mandatory interface required by the
flask.views.View.dispatch_request()
. Will be called by the Flask framework to service the request.Single item with given unique identifier will be retrieved from database and injected into template to be displayed to the user.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
Return menu entry title for the view.
Default implementation returns the return value of
hawat.view.BaseView.get_view_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry title for the view.
- Return type
str
- classmethod get_view_name()[source]
Return unique name for the view. Name must be unique in the namespace of parent blueprint/module and should contain only characters
[a-z0-9]
. It will be used for generating endpoint name for the view.This method does not have any default implementation and must be overridden by a subclass.
- Returns
Name for the view.
- Return type
str
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- classmethod get_view_url(**kwargs)[source]
Return view URL.
- Parameters
kwargs (dict) – Optional parameters.
- Returns
URL for the view.
- Return type
str
- methods: t.ClassVar[t.Optional[t.Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.EventsBlueprint(name, import_name, **kwargs)[source]
Bases:
HawatBlueprint
Pluggable module - IDEA event database (events).
- class hawat.blueprints.events.SearchView[source]
Bases:
HTMLMixin
,AbstractSearchView
View responsible for searching the IDEA event database and presenting the results in the form of HTML page.
Get breadcrumbs menu.
Implementation of
hawat.view.ItemListView.get_context_action_menu()
.
- has_help = True
- methods: t.ClassVar[t.Optional[t.Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.events.ShowView[source]
Bases:
HTMLMixin
,AbstractShowView
Detailed IDEA event view that presents the result as HTML page.
Get action menu for particular item.
- has_help = True
- methods: t.ClassVar[t.Optional[t.Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- hawat.blueprints.events.get_blueprint()[source]
Mandatory interface for
hawat.Hawat
and factory function. This function must return a valid instance ofhawat.app.HawatBlueprint
orflask.Blueprint
.
Submodules
- hawat.blueprints.events.forms module
EventDashboardForm
SimpleEventSearchForm
SimpleEventSearchForm.categories
SimpleEventSearchForm.classes
SimpleEventSearchForm.description
SimpleEventSearchForm.detector_types
SimpleEventSearchForm.detectors
SimpleEventSearchForm.dt_from
SimpleEventSearchForm.dt_to
SimpleEventSearchForm.groups
SimpleEventSearchForm.host_addrs
SimpleEventSearchForm.host_ports
SimpleEventSearchForm.host_types
SimpleEventSearchForm.inspection_errs
SimpleEventSearchForm.is_multivalue()
SimpleEventSearchForm.not_categories
SimpleEventSearchForm.not_classess
SimpleEventSearchForm.not_detector_types
SimpleEventSearchForm.not_detectors
SimpleEventSearchForm.not_groups
SimpleEventSearchForm.not_inspection_errs
SimpleEventSearchForm.not_protocols
SimpleEventSearchForm.not_severities
SimpleEventSearchForm.protocols
SimpleEventSearchForm.severities
SimpleEventSearchForm.sortby
SimpleEventSearchForm.source_addrs
SimpleEventSearchForm.source_ports
SimpleEventSearchForm.source_types
SimpleEventSearchForm.st_from
SimpleEventSearchForm.st_to
SimpleEventSearchForm.target_addrs
SimpleEventSearchForm.target_ports
SimpleEventSearchForm.target_types
get_available_groups()