type docker_api.py

This commit is contained in:
pnearing
2023-03-11 21:16:08 -05:00
parent 8a4a6d89ee
commit 71d2616e1a

View File

@ -1,12 +1,23 @@
from typing import Optional
from . import base_api_core
class Docker(base_api_core.Core):
def __init__(self, ip_address, port, username, password, secure=False, cert_verify=False, dsm_version=7,
debug=True, otp_code=None):
def __init__(self,
ip_address: str,
port: str,
username: str,
password: str,
secure: bool = False,
cert_verify: bool = False,
dsm_version: int = 7,
debug: bool = True,
otp_code: Optional[int] = None
)-> None:
super(Docker, self).__init__(ip_address, port, username, password, secure, cert_verify, dsm_version, debug, otp_code)
def containers(self):
return
def containers(self) -> dict[str, object]:
api_name = 'SYNO.Docker.Container'
info = self.gen_list[api_name]
api_path = info['path']
@ -14,7 +25,7 @@ class Docker(base_api_core.Core):
return self.request_data(api_name, api_path, req_param)
def container_resources(self):
def container_resources(self) -> dict[str, object]:
api_name = 'SYNO.Docker.Container.Resource'
info = self.gen_list[api_name]
api_path = info['path']
@ -22,7 +33,7 @@ class Docker(base_api_core.Core):
return self.request_data(api_name, api_path, req_param)
def system_resources(self):
def system_resources(self) -> dict[str, object]:
api_name = 'SYNO.Core.System.Utilization'
info = self.gen_list[api_name]
api_path = info['path']
@ -30,7 +41,7 @@ class Docker(base_api_core.Core):
return self.request_data(api_name, api_path, req_param)
def downloaded_images(self):
def downloaded_images(self) -> dict[str, object]:
api_name = 'SYNO.Docker.Image'
info = self.gen_list[api_name]
api_path = info['path']
@ -39,7 +50,7 @@ class Docker(base_api_core.Core):
return self.request_data(api_name, api_path, req_param)
def images_registry_resources(self):
def images_registry_resources(self) -> dict[str, object]:
api_name = 'SYNO.Docker.Registry'
info = self.gen_list[api_name]
api_path = info['path']
@ -47,7 +58,7 @@ class Docker(base_api_core.Core):
return self.request_data(api_name, api_path, req_param)
def network(self):
def network(self) -> dict[str, object]:
api_name = 'SYNO.Docker.Network'
info = self.gen_list[api_name]
api_path = info['path']