# waddle
the penguins api and tooling around aws's parameter store
![codebuild](https://codebuild.us-east-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUU82MEFwb2JTUzJ2OFJSOUI4eURSc01BNnBNb04zVTRvaUZxTERxb3U3Ui9HdkVJRUllOHBUdlNXVGpGVXpUeXllVkVncVE4cDIxcFBIMzh6SFFMUWFzPSIsIml2UGFyYW1ldGVyU3BlYyI6IkJlcmc3clNIbVVBaFRCWFUiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
## ParamBunch
Lets you access secrets stored in a file or from parameter store!
### From a file
Create a file called test.yml that will hold your config.
It can include both secrets and non-secrets
```yaml
meta:
kms_key: dev
region: us-west-2
profile: mycompany
aws.username: aws-user
```
Now add a secret to that file using the waddle cli
```bash
waddle add-secret -f /path/to/test.yml aws.password
```
waddle will prompt you to enter in the secret. As long as you have a
kms key called dev, waddle will add a kms-data-key-encrypted secret into
`test.yml`.
Now you can access configuration values in the test.yml configuration file
using the following syntax:
```python
from waddle import ParamBunch
conf = ParamBunch(filename='/path/to/test.yml')
AWS_USERNAME = conf.aws.username
AWS_PASSWORD = conf.get('aws.password', 'some default value')
```
### But I want to use parameter store </whine>
You can also load configs straight from AWS parameter store by providing a
prefix.
```python
from waddle import ParamBunch
conf = ParamBunch(prefix='/path/to/parameters')
# Access /path/to/paramaters/aws/username
AWS_USERNAME = conf.aws.username
```
You can also embed particular ssm parameters into a waddle configuration
by using the `!ssm` tag:
```yaml
dog: !ssm /my/dogs/name
meta:
profile: default
region: us-east-2
```
This will use the value from `ssm` for `/my/dogs/name` for the `dog` key
in the configuration.
## want to waddle your secrets up to SSM from a file?
In certain cases, you may want to keep files locally, but then push them
to aws as part of CI/CD. For example, if you want to keep a centralized
repository of your secrets that is shared among developers, you can encrypt
secrets in your config files using waddle. For application deployment, you can
push those files up to ssm using `waddle deploy` and/or delete them from ssm
using `waddle undeploy`.
```bash
waddle deploy -f /path/to/params.yml
```
- or -
```bash
waddle undeploy -f /path/to/params.yml
```
## Bunch
A class that offers pathy semantics
to access values in a dictionary.
### Bunch -- general usage
e.g.,
```python
from waddle import Bunch
values = {
'a': {
'b': {
'c': True,
'd': False,
},
},
}
a = Bunch(values)
assert a.b.c == True
assert a.b.d == False
a.cat.name = 'mycat'
assert a['cat.name'] == 'mycat'
assert 'cat.age' in a == False
assert a.get('cat.age', 22) == 22
assert a.setdefault('cat.age', 45) == 45
```
### Bunch -- env
You can use the built-in `env` function to use
the dictionary as a set of default values that
can be overridden by environment variables.
e.g.,
```python
import os
from waddle import Bunch
os.environ['FTP_PASSWORD'] = 'password'
config = {
'ftp': {
'host': '127.0.0.1',
'user': 'user',
}
}
config = Bunch(config)
env = config.env()
assert env('FTP_PASSWORD') == 'password'
assert env('FTP_HOST') == '127.0.0.1'
```
Raw data
{
"_id": null,
"home_page": "https://github.com/angry-penguins/waddle",
"name": "waddle",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "aws python parameter-store kms",
"author": "Preetam Shingavi",
"author_email": "p.shingavi@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/52/ba/ce83d6ecea9ed98aaa131f07dcfa41799fd59c64f1108729b2933ed3105e/waddle-1.10.tar.gz",
"platform": null,
"description": "# waddle\nthe penguins api and tooling around aws's parameter store\n![codebuild](https://codebuild.us-east-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUU82MEFwb2JTUzJ2OFJSOUI4eURSc01BNnBNb04zVTRvaUZxTERxb3U3Ui9HdkVJRUllOHBUdlNXVGpGVXpUeXllVkVncVE4cDIxcFBIMzh6SFFMUWFzPSIsIml2UGFyYW1ldGVyU3BlYyI6IkJlcmc3clNIbVVBaFRCWFUiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)\n\n## ParamBunch\n\nLets you access secrets stored in a file or from parameter store!\n\n### From a file\n\nCreate a file called test.yml that will hold your config. \nIt can include both secrets and non-secrets\n\n```yaml\nmeta:\n kms_key: dev\n region: us-west-2\n profile: mycompany\naws.username: aws-user\n```\n\nNow add a secret to that file using the waddle cli\n\n```bash\nwaddle add-secret -f /path/to/test.yml aws.password\n```\n\nwaddle will prompt you to enter in the secret. As long as you have a \nkms key called dev, waddle will add a kms-data-key-encrypted secret into \n`test.yml`. \n\nNow you can access configuration values in the test.yml configuration file\nusing the following syntax:\n\n```python\nfrom waddle import ParamBunch\nconf = ParamBunch(filename='/path/to/test.yml')\nAWS_USERNAME = conf.aws.username\nAWS_PASSWORD = conf.get('aws.password', 'some default value')\n``` \n\n### But I want to use parameter store </whine>\n\nYou can also load configs straight from AWS parameter store by providing a \nprefix.\n\n```python\nfrom waddle import ParamBunch\nconf = ParamBunch(prefix='/path/to/parameters')\n# Access /path/to/paramaters/aws/username\nAWS_USERNAME = conf.aws.username\n```\n\nYou can also embed particular ssm parameters into a waddle configuration\nby using the `!ssm` tag:\n\n```yaml\ndog: !ssm /my/dogs/name\nmeta:\n profile: default\n region: us-east-2\n```\n\nThis will use the value from `ssm` for `/my/dogs/name` for the `dog` key \nin the configuration. \n\n\n## want to waddle your secrets up to SSM from a file?\n\nIn certain cases, you may want to keep files locally, but then push them\nto aws as part of CI/CD. For example, if you want to keep a centralized \nrepository of your secrets that is shared among developers, you can encrypt\nsecrets in your config files using waddle. For application deployment, you can\npush those files up to ssm using `waddle deploy` and/or delete them from ssm\nusing `waddle undeploy`.\n\n```bash\nwaddle deploy -f /path/to/params.yml\n```\n\n- or -\n\n```bash\nwaddle undeploy -f /path/to/params.yml\n```\n\n## Bunch\n\nA class that offers pathy semantics \nto access values in a dictionary.\n\n### Bunch -- general usage\ne.g.,\n\n```python\nfrom waddle import Bunch\nvalues = {\n 'a': {\n 'b': {\n 'c': True,\n 'd': False,\n }, \n },\n}\na = Bunch(values)\nassert a.b.c == True\nassert a.b.d == False\na.cat.name = 'mycat'\nassert a['cat.name'] == 'mycat'\nassert 'cat.age' in a == False\nassert a.get('cat.age', 22) == 22\nassert a.setdefault('cat.age', 45) == 45\n``` \n\n### Bunch -- env\n\nYou can use the built-in `env` function to use\nthe dictionary as a set of default values that\ncan be overridden by environment variables.\n\ne.g.,\n\n```python\nimport os\nfrom waddle import Bunch\nos.environ['FTP_PASSWORD'] = 'password'\nconfig = {\n 'ftp': {\n 'host': '127.0.0.1',\n 'user': 'user',\n }\n}\nconfig = Bunch(config)\nenv = config.env()\nassert env('FTP_PASSWORD') == 'password'\nassert env('FTP_HOST') == '127.0.0.1'\n```\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "A pathy wrapper around aws parameter store",
"version": "1.10",
"project_urls": {
"Homepage": "https://github.com/angry-penguins/waddle"
},
"split_keywords": [
"aws",
"python",
"parameter-store",
"kms"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "52bace83d6ecea9ed98aaa131f07dcfa41799fd59c64f1108729b2933ed3105e",
"md5": "643f8c1b8f19db8c4be1d7cc5923b54d",
"sha256": "7bee373f88837c4d33004f1b806c0e548ceef2c4ec61ead007cf23098b7a5c4a"
},
"downloads": -1,
"filename": "waddle-1.10.tar.gz",
"has_sig": false,
"md5_digest": "643f8c1b8f19db8c4be1d7cc5923b54d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20603,
"upload_time": "2024-10-14T13:29:08",
"upload_time_iso_8601": "2024-10-14T13:29:08.332833Z",
"url": "https://files.pythonhosted.org/packages/52/ba/ce83d6ecea9ed98aaa131f07dcfa41799fd59c64f1108729b2933ed3105e/waddle-1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-14 13:29:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "angry-penguins",
"github_project": "waddle",
"github_not_found": true,
"lcname": "waddle"
}