The watcher.objects.audit_template Module

An Audit may be launched several times with the same settings (Goal, thresholds, ...). Therefore it makes sense to save those settings in some sort of Audit preset object, which is known as an Audit Template.

An Audit Template contains at least the Goal of the Audit.

It may also contain some error handling settings indicating whether:

and how many retries should be attempted before failure occurs (also the latter can be complex: for example the scenario in which there are many first-time failures on ultimately successful Actions).

Moreover, an Audit Template may contain some settings related to the level of automation for the Action Plan that will be generated by the Audit. A flag will indicate whether the Action Plan will be launched automatically or will need a manual confirmation from the Administrator.

Last but not least, an Audit Template may contain a list of extra parameters related to the Strategy configuration. These parameters can be provided as a list of key-value pairs.

class watcher.objects.audit_template.AuditTemplate(context, **kwargs)[source]

Bases: watcher.objects.base.WatcherObject

create(context=None)[source]

Create a AuditTemplate record in the DB.

Parameters:context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
destroy(context=None)[source]

Delete the AuditTemplate from the DB.

Parameters:context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
classmethod get(context, audit_template_id)[source]

Find an audit template based on its id or uuid

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • audit_template_id – the id or uuid of a audit_template.
Returns:

a AuditTemplate object.

classmethod get_by_id(context, audit_template_id)[source]

Find an audit template based on its integer id

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • audit_template_id – the id of a audit_template.
Returns:

a AuditTemplate object.

classmethod get_by_name(context, name)[source]

Find an audit template based on name

Parameters:
  • name – the logical name of a audit_template.
  • context – Security context
Returns:

a AuditTemplate object.

classmethod get_by_uuid(context, uuid)[source]

Find an audit template based on uuid

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • uuid – the uuid of a audit_template.
Returns:

a AuditTemplate object.

classmethod list(context, filters=None, limit=None, marker=None, sort_key=None, sort_dir=None)[source]

Return a list of AuditTemplate objects.

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • filters – dict mapping the filter key to a value.
  • limit – maximum number of resources to return in a single result.
  • marker – pagination marker for large data sets.
  • sort_key – column to sort results by.
  • sort_dir – direction to sort. “asc” or “desc”.
Returns:

a list of AuditTemplate object.

refresh(context=None)[source]

Loads updates for this AuditTemplate.

Loads a audit_template with the same uuid from the database and checks for updated attributes. Updates are applied from the loaded audit_template column by column, if there are any updates.

Parameters:context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
save(context=None)[source]

Save updates to this AuditTemplate.

Updates will be made column by column based on the result of self.what_changed().

Parameters:context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
soft_delete(context=None)[source]

soft Delete the AuditTemplate from the DB.

Parameters:context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)

Previous topic

The watcher.objects.audit Module

Next topic

The watcher.objects.base Module

Project Source

This Page