|
40 | 40 | PermissionListError,
|
41 | 41 | PermissionResetError,
|
42 | 42 | PermissionUpdateError,
|
| 43 | + ServerAvailableOptionsGetError, |
| 44 | + ServerCurrentOptionsGetError, |
43 | 45 | ServerDetailsError,
|
44 | 46 | ServerEchoError,
|
45 | 47 | ServerEncryptionError,
|
@@ -933,6 +935,58 @@ def response_handler(resp: Response) -> Json:
|
933 | 935 |
|
934 | 936 | return self._execute(request, response_handler)
|
935 | 937 |
|
| 938 | + def options(self) -> Result[Json]: |
| 939 | + """Return the currently-set server options. |
| 940 | +
|
| 941 | + As this API may reveal sensitive data about the deployment, it can only |
| 942 | + be accessed from inside the _system database. In addition, there is a |
| 943 | + policy control startup option --server.options-api that determines if and |
| 944 | + to whom the API is made available. This option can have the following |
| 945 | + values: |
| 946 | + - disabled: API is disabled. |
| 947 | + - jwt: API can only be accessed via superuser JWT. |
| 948 | + - admin: API can be accessed by admin users in the _system database only. |
| 949 | + - public: everyone with access to _system database can access the API. |
| 950 | +
|
| 951 | + :return: Server options. |
| 952 | + :rtype: dict |
| 953 | + """ |
| 954 | + request = Request(method="get", endpoint="/_admin/options") |
| 955 | + |
| 956 | + def response_handler(resp: Response) -> Json: |
| 957 | + if resp.is_success: |
| 958 | + result: Json = resp.body |
| 959 | + return result |
| 960 | + raise ServerCurrentOptionsGetError(resp, request) |
| 961 | + |
| 962 | + return self._execute(request, response_handler) |
| 963 | + |
| 964 | + def options_available(self) -> Result[Json]: |
| 965 | + """Return a description of all available server options. |
| 966 | +
|
| 967 | + As this API may reveal sensitive data about the deployment, it can only |
| 968 | + be accessed from inside the _system database. In addition, there is a |
| 969 | + policy control startup option --server.options-api that determines if and |
| 970 | + to whom the API is made available. This option can have the following |
| 971 | + values: |
| 972 | + - disabled: API is disabled. |
| 973 | + - jwt: API can only be accessed via superuser JWT. |
| 974 | + - admin: API can be accessed by admin users in the _system database only. |
| 975 | + - public: everyone with access to _system database can access the options API. |
| 976 | +
|
| 977 | + :return: Server options. |
| 978 | + :rtype: dict |
| 979 | + """ |
| 980 | + request = Request(method="get", endpoint="/_admin/options-description") |
| 981 | + |
| 982 | + def response_handler(resp: Response) -> Json: |
| 983 | + if resp.is_success: |
| 984 | + result: Json = resp.body |
| 985 | + return result |
| 986 | + raise ServerAvailableOptionsGetError(resp, request) |
| 987 | + |
| 988 | + return self._execute(request, response_handler) |
| 989 | + |
936 | 990 | #######################
|
937 | 991 | # Database Management #
|
938 | 992 | #######################
|
|
0 commit comments