# nameko-vault
Extension for [Nameko](https://www.nameko.io/) that integrates with
[Vault](https://www.vaultproject.io/).
To use this tool it is necessary to configure the following parameters in your
nameko config.yml file:
```
VAULT_URL: <vault_api_url>
VAULT_TOKEN: <authentication_token>
```
## Usage
To use the tool it's needed inform the mount point of the path in which you want
to obtain any secrets. This mount point can be informed when instantiating the
provider or passing this information directly to the method being used.
### Example 1:
```python
# path: example/path/secret
vault = VaultProvider(mount_point="example")
vault.get_kv_secret(path="path/secret")
```
### Example 2:
```python
# path: example/path/secret
vault = VaultProvider()
vault.get_kv_secret(mount_point="example", path="path/secret")
```
## List Secrets
The method `get_kv_secrets_list` returns a list of secrets contained in a given
path
```python
vault = VaultProvider()
vault.get_kv_secrets_list(mount_point="example", path="path")
```
```
['path/test1', 'path/test2']
```
## Get KV Secret Data
The method `get_kv_secret` returns the content cotained in a given path
```python
vault = VaultProvider()
vault.get_kv_secret(mount_point="example", path="path/test")
```
```
[
{
"data":{
"pass":"test",
"user":"sample"
},
"metadata":{
"created_time":"2020-07-01T17:44:48.054175763Z",
"deletion_time":"",
"destroyed":False,
"version":1
}
}
]
```
## Create or Update KV Secret
Method to create an secret or update an existing one in a given path.
```python
vault = VaultProvider()
secret = {"example": "Test", "number": 42}
vault.create_or_update_kv_secret(mount_point="example", path="path/test", secret=secret)
```
```
{
'request_id': '4ce62ee7-0f88-3efc-d745-5e2fbc423789',
'lease_id': '',
'renewable': False,
'lease_duration': 0,
'data': {
'created_time': '2020-09-10T00:25:40.92411625Z',
'deletion_time': '',
'destroyed': False,
'version': 1
},
'wrap_info': None,
'warnings': None,
'auth': None
}
```
## Patch KV Secret
Method to update an existing path. Either to add a new key/value to the secret and/or update the value for an existing key. Raises an `hvac.exceptions.InvalidRequest` if the path hasn’t been written to previously.
```python
vault = VaultProvider()
secret = {"example": "New Test"}
vault.patch_kv_secret(mount_point="example", path="path/test", secret=secret)
```
```
{
'request_id': '7bf2a869-dc66-efa2-3679-814ef76fb447',
'lease_id': '',
'renewable': False,
'lease_duration': 0,
'data': {
'created_time': '2020-09-10T00:31:32.6783082Z',
'deletion_time': '',
'destroyed': False,
'version': 2
},
'wrap_info': None,
'warnings': None,
'auth': None
}
```
## Delete KV Secret (metadata and all versions)
Method to delete an existing path with all his versions and metadata on a given path.
```python
vault = VaultProvider()
path = "path/secret"
vault.delete_metadata_and_all_versions_kv_secret(path)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/instruct-br/nameko-vault",
"name": "nameko-vault",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "",
"keywords": "nameko,vault",
"author": "Instruct Developers",
"author_email": "oss@instruct.com.br",
"download_url": "https://files.pythonhosted.org/packages/b0/49/5b02ce278e761c64163c63c43f39517920d15c3963bb1aff521d2d72a5fe/nameko_vault-0.4.0.tar.gz",
"platform": null,
"description": "# nameko-vault\n\nExtension for [Nameko](https://www.nameko.io/) that integrates with\n[Vault](https://www.vaultproject.io/).\n\nTo use this tool it is necessary to configure the following parameters in your\nnameko config.yml file:\n\n```\nVAULT_URL: <vault_api_url>\nVAULT_TOKEN: <authentication_token>\n```\n\n## Usage\n\nTo use the tool it's needed inform the mount point of the path in which you want\nto obtain any secrets. This mount point can be informed when instantiating the\nprovider or passing this information directly to the method being used.\n\n### Example 1:\n```python\n# path: example/path/secret\nvault = VaultProvider(mount_point=\"example\")\nvault.get_kv_secret(path=\"path/secret\")\n```\n\n### Example 2:\n```python\n# path: example/path/secret\nvault = VaultProvider()\nvault.get_kv_secret(mount_point=\"example\", path=\"path/secret\")\n```\n\n## List Secrets\n\nThe method `get_kv_secrets_list` returns a list of secrets contained in a given\npath\n\n```python\nvault = VaultProvider()\nvault.get_kv_secrets_list(mount_point=\"example\", path=\"path\")\n```\n```\n['path/test1', 'path/test2']\n```\n\n## Get KV Secret Data\n\nThe method `get_kv_secret` returns the content cotained in a given path\n\n```python\nvault = VaultProvider()\nvault.get_kv_secret(mount_point=\"example\", path=\"path/test\")\n```\n```\n[\n {\n \"data\":{\n \"pass\":\"test\",\n \"user\":\"sample\"\n },\n \"metadata\":{\n \"created_time\":\"2020-07-01T17:44:48.054175763Z\",\n \"deletion_time\":\"\",\n \"destroyed\":False,\n \"version\":1\n }\n }\n]\n```\n\n## Create or Update KV Secret\nMethod to create an secret or update an existing one in a given path.\n\n```python\nvault = VaultProvider()\nsecret = {\"example\": \"Test\", \"number\": 42}\nvault.create_or_update_kv_secret(mount_point=\"example\", path=\"path/test\", secret=secret)\n```\n```\n{\n 'request_id': '4ce62ee7-0f88-3efc-d745-5e2fbc423789',\n 'lease_id': '',\n 'renewable': False,\n 'lease_duration': 0,\n 'data': {\n 'created_time': '2020-09-10T00:25:40.92411625Z',\n 'deletion_time': '',\n 'destroyed': False,\n 'version': 1\n },\n 'wrap_info': None,\n 'warnings': None,\n 'auth': None\n}\n```\n\n## Patch KV Secret\nMethod to update an existing path. Either to add a new key/value to the secret and/or update the value for an existing key. Raises an `hvac.exceptions.InvalidRequest` if the path hasn\u2019t been written to previously.\n\n```python\nvault = VaultProvider()\nsecret = {\"example\": \"New Test\"}\nvault.patch_kv_secret(mount_point=\"example\", path=\"path/test\", secret=secret)\n```\n```\n{\n 'request_id': '7bf2a869-dc66-efa2-3679-814ef76fb447',\n 'lease_id': '',\n 'renewable': False,\n 'lease_duration': 0,\n 'data': {\n 'created_time': '2020-09-10T00:31:32.6783082Z',\n 'deletion_time': '',\n 'destroyed': False,\n 'version': 2\n },\n 'wrap_info': None,\n 'warnings': None,\n 'auth': None\n}\n```\n\n## Delete KV Secret (metadata and all versions)\nMethod to delete an existing path with all his versions and metadata on a given path.\n\n```python\nvault = VaultProvider()\npath = \"path/secret\"\nvault.delete_metadata_and_all_versions_kv_secret(path)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Nameko extension to provide connection with Vault",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/instruct-br/nameko-vault",
"Repository": "https://github.com/instruct-br/nameko-vault"
},
"split_keywords": [
"nameko",
"vault"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bfd1db19a83f522a2f0d4d1d0bde43ff0a2fc6b22072d32c7630bce53a1813b1",
"md5": "ecdbef27bf39a7adae81ae46eea213e3",
"sha256": "e572da09b81ee22a6bae5ce97b454e8cecb4710b8f838cef68bdfe9e2c977944"
},
"downloads": -1,
"filename": "nameko_vault-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ecdbef27bf39a7adae81ae46eea213e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 4767,
"upload_time": "2023-08-04T11:38:00",
"upload_time_iso_8601": "2023-08-04T11:38:00.455636Z",
"url": "https://files.pythonhosted.org/packages/bf/d1/db19a83f522a2f0d4d1d0bde43ff0a2fc6b22072d32c7630bce53a1813b1/nameko_vault-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b0495b02ce278e761c64163c63c43f39517920d15c3963bb1aff521d2d72a5fe",
"md5": "ad128075dadc7a4c6ee60a630d262b03",
"sha256": "d04621fa0234e2654feaaa02d7b1174922e42aeaa6fae7aaa66f0c7c1ccc9a08"
},
"downloads": -1,
"filename": "nameko_vault-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "ad128075dadc7a4c6ee60a630d262b03",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 3682,
"upload_time": "2023-08-04T11:38:01",
"upload_time_iso_8601": "2023-08-04T11:38:01.954146Z",
"url": "https://files.pythonhosted.org/packages/b0/49/5b02ce278e761c64163c63c43f39517920d15c3963bb1aff521d2d72a5fe/nameko_vault-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-04 11:38:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "instruct-br",
"github_project": "nameko-vault",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nameko-vault"
}