Skip to content

Commit 09f594e

Browse files
committed
Includes support for deleting tables in the VaultAPI server
1 parent 94b6874 commit 09f594e

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

vaultapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .exceptions import VaultAPIClientError
55
from .main import LOGGER, VaultAPIClient
66

7-
version = "0.1.0"
7+
version = "0.1.1"
88

99

1010
def commandline():

vaultapi/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class EndpointMapping:
2525
put_secret: str = "/put-secret"
2626
list_tables: str = "/list-tables"
2727
create_table: str = "/create-table"
28+
delete_table: str = "/delete-table"
2829
delete_secret: str = "/delete-secret"
2930

3031

vaultapi/main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ def create_table(self, table_name: str) -> Dict[str, str]:
135135
response = self.SESSION.post(url, params={"table_name": table_name})
136136
return process_response(response)
137137

138+
def delete_table(self, table_name: str) -> Dict[str, str]:
139+
"""Deletes an existing table.
140+
141+
Args:
142+
table_name: Table name.
143+
144+
Returns:
145+
Dict[str, str]:
146+
Returns the server response.
147+
"""
148+
url = urljoin(self.env_config.vault_server, server_map.delete_table)
149+
response = self.SESSION.delete(url, params={"table_name": table_name})
150+
return process_response(response)
151+
138152
def get_secret(self, key: str, table_name: str) -> Dict[str, str]:
139153
"""Retrieves multiple secrets from a table.
140154

0 commit comments

Comments
 (0)