66
77r"""`server` exposes an API to allow modifications (add, delete, modify) to
88UA Gateway plug-in server endpoint objects within the Kepware Configuration API.
9- Certificate read and trust functionality is also available for the server endpoints.
9+ Certificate store read, remove and trust functionality is also available for the
10+ server endpoints.
1011"""
1112
1213from typing import Union
1314from ..connection import server
1415from ..error import KepError , KepHTTPError
15- from ..ua_gateway .common import _INTER_TYPE , _change_cert_trust , _create_url_cert , _create_url_server
16+ from ..ua_gateway .common import _INTER_TYPE , _change_cert_trust , _create_url_cert , _create_url_server , _delete_cert_truststore
1617
1718
1819def get_certificate (server : server , certificate : str ) -> dict :
@@ -49,7 +50,7 @@ def get_all_certificates(server: server, *, options: dict = None) -> list:
4950 return r .payload
5051
5152def trust_certificate (server : server , certificate : str ) -> bool :
52- '''Trusts the certificate in the UAG server endpoint certifcate store. This is updating the trust state of UA client instance
53+ '''Trusts the certificate in the UAG server endpoint certificate store. This is updating the trust state of UA client instance
5354 certificates that are used by UAG server endpoints for trust purposes in the UA security model.
5455
5556 :param server: instance of the `server` class
@@ -63,7 +64,7 @@ def trust_certificate(server: server, certificate: str) -> bool:
6364 return _change_cert_trust (server , _INTER_TYPE .SERVER , certificate , True )
6465
6566def reject_certificate (server : server , certificate : str ) -> bool :
66- '''Rejects the certificate in the UAG server endpoint certifcate store.
67+ '''Rejects the certificate in the UAG server endpoint certificate store.
6768
6869 :param server: instance of the `server` class
6970 :param certificate: name of certificate
@@ -75,6 +76,19 @@ def reject_certificate(server: server, certificate: str) -> bool:
7576 '''
7677 return _change_cert_trust (server , _INTER_TYPE .SERVER , certificate , False )
7778
79+ def delete_certificate (server : server , certificate : str ) -> bool :
80+ '''Deletes the certificate in the UAG server endpoint certificate store.
81+
82+ :param server: instance of the `server` class
83+ :param certificate: name of certificate
84+
85+ :return: True - If a "HTTP 200 - OK" is received from Kepware server
86+
87+ :raises KepHTTPError: If urllib provides an HTTPError
88+ :raises KepURLError: If urllib provides an URLError
89+ '''
90+ return _delete_cert_truststore (server , _INTER_TYPE .SERVER , certificate )
91+
7892def get_ua_server_endpoint (server : server , ua_server_endpoint : str ) -> dict :
7993 '''Returns the properties of the UAG server endpoint object.
8094
0 commit comments