snap_plugin.v1.config_policy module¶
-
class
snap_plugin.v1.config_policy.
ConfigPolicy
(*args)¶ Bases:
object
ConfigPolicy describes the configuration items for a plugin.
A plugin exposes its configuration to the Snap framework through the object
ConfigPolicy
. The policy describes the configuration items value type (string
,float
,integer
andbool
), it’s default value (if any) as well as its contraints (min, max, etc).Parameters: *args – A variable length list of tuples/lists where the first item of the list/tuple is a tuple/list representing the namespace. The second item is a tuple/list where the first item is the config’s key and the second is the specific configuration rule that should be applied. Example:
snap.ConfigPolicy( [ ("random"), [ ( "int_max", snap.IntegerRule(default=100, minimum=1, maximum=10000) ), ( "int_min", snap.IntegerRule(default=0, minimum=0) ) ] ] )
- Also see:
snap_plugin.v1.integer_policy.IntegerRule
snap_plugin.v1.float_policy.FloatRule
snap_plugin.v1.string_policy.StringRule
snap_plugin.v1.bool_policy.BoolPolicy