API Documentation¶
-
aumbry.
FILE
¶ str – Alias of SourceTypes.file
-
aumbry.
CONSUL
¶ str – Alias of SourceTypes.consul
-
class
aumbry.
Attr
(attr_name, attr_type, serialize=True, required=False, coerce=None)¶ Attribute Definition
Parameters: - name – Python attribute name
- type – Attribute type (e.g str, int, dict, etc)
- serialize – Determines if the attribute can be serialized
- required – Forces attribute to be defined
- coerce – Forces attribute to be coerced to its type (primitive types)
-
aumbry.
load
(source_name, config_class, options=None, search_paths=None, preprocessor=None, handler=None)¶ Loads a configration from a source into the specified Config type
Parameters: - source_name (str) – The name of the desired source.
- config_class (AumbryConfig) – The resulting class of configuration you wish to deserialize the data into.
- options (dict, optional) – The options used by the source handler. The keys are determined by each source handler. Refer to your source handler documentation on what options are available.
- search_paths (list, optional) – A list paths for custom source handlers
- preprocessor (function) – A function that pre-processes the source data before loading into the configuration object.
- handler (AbstractHandler) – An instance of a handler to process the configuration data.
Returns: An instance of the passed in config_class
-
aumbry.
save
(source_name, config_inst, options=None, search_paths=None, preprocessor=None, handler=None)¶ Loads a configration from a source into the specified Config type
Parameters: - source_name (str) – The name of the desired source.
- config_inst (AumbryConfig) – The instance of a configuration class wish save.
- options (dict, optional) – The options used by the source handler. The keys are determined by each source handler. Refer to your source handler documentation on what options are available.
- search_paths (list, optional) – A list paths for custom source handlers
- preprocessor (function) – A function that pre-processes the configration data before saving to the source.
- handler (AbstractHandler) – An instance of a handler to process the configuration data. Defaults to the configuration handler.
-
class
aumbry.
JsonConfig
¶ A type of AumbryConfig for JSON Configurations.
-
class
aumbry.
YamlConfig
¶ A type of AumbryConfig for Yaml Configurations.
-
class
aumbry.
GenericConfig
¶ A type of AumbryConfig for Generic Dict Configurations.
-
class
aumbry.
SourceTypes
¶ Used to specified the source type to load a configuration.
-
consul
= 'consul'¶
-
etcd2
= 'etcd2'¶
-
fernet
= 'fernet'¶
-
file
= 'file'¶
-
parameter_store
= 'parameter_store'¶
-
Format Handlers¶
-
class
aumbry.formats.generic.
GenericHandler
¶ -
deserialize
(raw_config, config_cls)¶ Method to handle deserialization to a Config object.
-
serialize
(config)¶ Method to handle serialization to a string.
-