This commit is contained in:
2025-12-01 18:10:46 +01:00
parent 117da5fc5d
commit 2320ff1b53
2 changed files with 22 additions and 3 deletions

12
port.py
View File

@@ -10,7 +10,7 @@ from concurrent.futures import ThreadPoolExecutor
logger = logging.getLogger(__name__)
from tabulate import tabulate
from git import Repo # pip install gitpython
import base64
class Portainer:
"""
Simple wrapper around the module-level Portainer helper functions.
@@ -694,3 +694,13 @@ class Portainer:
def __repr__(self):
pass
def create_secret(self, name, value, endpoint_id=None, timeout=None):
endpoint_id = int(self.endpoints["by_name"][endpoint_id])
path = f"/endpoints/{endpoint_id}/docker/secrets/create"
encoded = base64.b64encode(value.encode()).decode()
data = {
"Name": name,
"Data": encoded
}
self.api_post(path, data, timeout=timeout)