Skip to content

Commit

Permalink
Includes support for deleting tables in the VaultAPI server
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Jan 22, 2025
1 parent 94b6874 commit 09f594e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vaultapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .exceptions import VaultAPIClientError
from .main import LOGGER, VaultAPIClient

version = "0.1.0"
version = "0.1.1"


def commandline():
Expand Down
1 change: 1 addition & 0 deletions vaultapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class EndpointMapping:
put_secret: str = "/put-secret"
list_tables: str = "/list-tables"
create_table: str = "/create-table"
delete_table: str = "/delete-table"
delete_secret: str = "/delete-secret"


Expand Down
14 changes: 14 additions & 0 deletions vaultapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@ def create_table(self, table_name: str) -> Dict[str, str]:
response = self.SESSION.post(url, params={"table_name": table_name})
return process_response(response)

def delete_table(self, table_name: str) -> Dict[str, str]:
"""Deletes an existing table.
Args:
table_name: Table name.
Returns:
Dict[str, str]:
Returns the server response.
"""
url = urljoin(self.env_config.vault_server, server_map.delete_table)
response = self.SESSION.delete(url, params={"table_name": table_name})
return process_response(response)

def get_secret(self, key: str, table_name: str) -> Dict[str, str]:
"""Retrieves multiple secrets from a table.
Expand Down

0 comments on commit 09f594e

Please sign in to comment.