|
38 | 38 | PermissionListError, |
39 | 39 | PermissionResetError, |
40 | 40 | PermissionUpdateError, |
| 41 | + ServerEncryptionError, |
41 | 42 | ServerStatusError, |
| 43 | + ServerTLSError, |
| 44 | + ServerTLSReloadError, |
42 | 45 | ServerVersionError, |
43 | 46 | TaskCreateError, |
44 | 47 | TaskDeleteError, |
@@ -2072,6 +2075,81 @@ def response_handler(resp: Response) -> Json: |
2072 | 2075 |
|
2073 | 2076 | return await self._executor.execute(request, response_handler) |
2074 | 2077 |
|
| 2078 | + async def tls(self) -> Result[Json]: |
| 2079 | + """Return TLS data (keyfile, clientCA). |
| 2080 | +
|
| 2081 | + This API requires authentication. |
| 2082 | +
|
| 2083 | + Returns: |
| 2084 | + dict: dict containing the following components: |
| 2085 | + - keyfile: Information about the key file. |
| 2086 | + - clientCA: Information about the Certificate Authority (CA) for client certificate verification. |
| 2087 | +
|
| 2088 | + Raises: |
| 2089 | + ServerTLSError: If the operation fails. |
| 2090 | +
|
| 2091 | + References: |
| 2092 | + - `get-the-tls-data <https://docs.arangodb.com/stable/develop/http-api/security/#get-the-tls-data>`__ |
| 2093 | + """ # noqa: E501 |
| 2094 | + request = Request(method=Method.GET, endpoint="/_admin/server/tls") |
| 2095 | + |
| 2096 | + def response_handler(resp: Response) -> Json: |
| 2097 | + if not resp.is_success: |
| 2098 | + raise ServerTLSError(resp, request) |
| 2099 | + result: Json = self.deserializer.loads(resp.raw_body)["result"] |
| 2100 | + return result |
| 2101 | + |
| 2102 | + return await self._executor.execute(request, response_handler) |
| 2103 | + |
| 2104 | + async def reload_tls(self) -> Result[Json]: |
| 2105 | + """Reload TLS data (keyfile, clientCA). |
| 2106 | +
|
| 2107 | + This is a protected API and can only be executed with superuser rights. |
| 2108 | +
|
| 2109 | + Returns: |
| 2110 | + dict: New TLS data. |
| 2111 | +
|
| 2112 | + Raises: |
| 2113 | + ServerTLSReloadError: If the operation fails. |
| 2114 | +
|
| 2115 | + References: |
| 2116 | + - `reload-the-tls-data <https://docs.arangodb.com/stable/develop/http-api/security/#reload-the-tls-data>`__ |
| 2117 | + """ # noqa: E501 |
| 2118 | + request = Request(method=Method.POST, endpoint="/_admin/server/tls") |
| 2119 | + |
| 2120 | + def response_handler(resp: Response) -> Json: |
| 2121 | + if not resp.is_success: |
| 2122 | + raise ServerTLSReloadError(resp, request) |
| 2123 | + result: Json = self.deserializer.loads(resp.raw_body)["result"] |
| 2124 | + return result |
| 2125 | + |
| 2126 | + return await self._executor.execute(request, response_handler) |
| 2127 | + |
| 2128 | + async def encryption(self) -> Result[Json]: |
| 2129 | + """Rotate the user-supplied keys for encryption. |
| 2130 | +
|
| 2131 | + This is a protected API and can only be executed with superuser rights. |
| 2132 | + This API is not available on Coordinator nodes. |
| 2133 | +
|
| 2134 | + Returns: |
| 2135 | + dict: Encryption keys. |
| 2136 | +
|
| 2137 | + Raises: |
| 2138 | + ServerEncryptionError: If the operation fails. |
| 2139 | +
|
| 2140 | + References: |
| 2141 | + - `rotate-the-encryption-keys <https://docs.arangodb.com/stable/develop/http-api/security/#rotate-the-encryption-keys>`__ |
| 2142 | + """ # noqa: E501 |
| 2143 | + request = Request(method=Method.POST, endpoint="/_admin/server/encryption") |
| 2144 | + |
| 2145 | + def response_handler(resp: Response) -> Json: |
| 2146 | + if not resp.is_success: |
| 2147 | + raise ServerEncryptionError(resp, request) |
| 2148 | + result: Json = self.deserializer.loads(resp.raw_body)["result"] |
| 2149 | + return result |
| 2150 | + |
| 2151 | + return await self._executor.execute(request, response_handler) |
| 2152 | + |
2075 | 2153 | async def list_transactions(self) -> Result[Jsons]: |
2076 | 2154 | """List all currently running stream transactions. |
2077 | 2155 |
|
|
0 commit comments