Configuration Management Library
Project description
[]
HydroPump-python
Configuration Management Library
HydroPump is an open-source Python library that provides a simple and efficient way to manage configuration files. It allows you to store and retrieve configuration data using different backends such as local file system and various cloud storage solutions.
Installation
You can install HydroPump using pip:
pip install hydropump
Usage
To use HydroPump, you need to import the hydropump module:
import hydropump
Backend Configuration
HydroPump supports different backends for storing configuration data. Currently, it supports file system backends with JSON and YAML file formats.
To configure a file system backend, you can create an instance of the FileSystemBackend class and specify the file extension:
backend = hydropump.FileSystemBackend(file_extension="json") # or "yaml"
Optionally you can specify the root directory in which to store the instruction files.
backend = hydropump.FileSystemBackend(file_extension="json", root_directory="path/to/dir")
Service Initialization
Once you have configured the backend, you can create a Service instance by passing the backend as a parameter:
service = hydropump.Service(backend=backend)
Service will be the interfacing object for accessing, creating, deleting and editing instruction files.
Creating Instructions
To create an instruction, you need to provide an instruction ID and a payload (configuration data) in the form of a dictionary. The instruction ID should be unique for each instruction.
# instruction_id is optional if left blank a UUID will be generated
instruction_id = "client-12345"
payload = {
"system": "darwin",
"date_created": "2023-07-09 11:18:23.001"
}
service.create_instruction(instruction_id=instruction_id, payload=payload)
This will create a JSON file (or YAML file if configured) with the given payload.
Retrieving Instructions
To retrieve an instruction, you can use the get_instruction method and provide the instruction ID:
returned_payload = service.get_instruction(instruction_id=instruction_id)
This will return the payload (configuration data) associated with the given instruction ID.
Example
Here's a complete example that demonstrates the usage of HydroPump:
import hydropump
backend = hydropump.FileSystemBackend(file_extension="json")
service = hydropump.Service(backend=backend)
instruction_id = "client-12345"
payload = {
"system": "darwin",
"date_created": "2023-07-09 11:18:23.001"
}
service.create_instruction(instruction_id=instruction_id, payload=payload)
returned_payload = service.get_instruction(instruction_id=instruction_id)
print(returned_payload)
Contributing
Contributions to HydroPump are welcome! If you find any issues or have suggestions for improvement, please open an issue on the GitHub repository. Pull requests are also appreciated.
Please make sure to follow the contribution guidelines when submitting your contributions.
License
HydroPump is released under the MIT License.
Thank you for using HydroPump! We hope it helps simplify your configuration management process. If you have any questions or need further assistance, feel free to reach out to us at support@hydropump.com.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hydropump-0.1.0.tar.gz.
File metadata
- Download URL: hydropump-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3e53a485db1016e5a854d2d2d981016267e57e4d9bb75259526f7de68f830da
|
|
| MD5 |
516704a280fe6395ad81a2bfe2b2a685
|
|
| BLAKE2b-256 |
b9f563a3db9903aab15528654f063e1f5765fd2d18fb0504bf85bdc8a692f6fe
|
File details
Details for the file hydropump-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hydropump-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f839cadca3ef4fa274eaf86b4b9aba4dfe8ebaf277c640d7697881b67220175a
|
|
| MD5 |
b6c32d0c3c2a196478d0eb8f4955369f
|
|
| BLAKE2b-256 |
95868fc9c3ce5916c961be358c616bd02c97beb8472f0e8caefa52a9baebe135
|