mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2025-12-14 02:34:53 +01:00
build
This commit is contained in:
12
port.py
12
port.py
@@ -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)
|
||||
Reference in New Issue
Block a user