The watcher.objects.strategy Module

class watcher.objects.strategy.Strategy(context, **kwargs)[source]

Bases: watcher.objects.base.WatcherObject

create(context=None)[source]

Create a Strategy 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.: Strategy(context)
destroy(context=None)[source]

Delete the Strategy 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.: Strategy(context)
classmethod get(context, strategy_id)[source]

Find a strategy 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.: Strategy(context)
  • strategy_id – the id or uuid of a strategy.
Returns:

a Strategy object.

classmethod get_by_id(context, strategy_id)[source]

Find a strategy 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.: Strategy(context)
  • strategy_id – the id of a strategy.
Returns:

a Strategy object.

classmethod get_by_name(context, name)[source]

Find a strategy based on name

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

a Strategy object.

classmethod get_by_uuid(context, uuid)[source]

Find a strategy 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.: Strategy(context)
  • uuid – the uuid of a strategy.
Returns:

a Strategy object.

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

Return a list of Strategy 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.: Strategy(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 Strategy object.

refresh(context=None)[source]

Loads updates for this Strategy.

Loads a strategy with the same uuid from the database and checks for updated attributes. Updates are applied from the loaded strategy 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.: Strategy(context)
save(context=None)[source]

Save updates to this Strategy.

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.: Strategy(context)
soft_delete(context=None)[source]

Soft Delete the Strategy 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.: Strategy(context)

Previous topic

The watcher.objects.scoring_engine Module

Next topic

The watcher.objects.utils Module

Project Source

This Page