diff --git a/docs/airlock_gateway_rest_api_lib/airlock_gateway_rest_api_lib.html b/docs/airlock_gateway_rest_api_lib/airlock_gateway_rest_api_lib.html index 9335c01..98c43c0 100644 --- a/docs/airlock_gateway_rest_api_lib/airlock_gateway_rest_api_lib.html +++ b/docs/airlock_gateway_rest_api_lib/airlock_gateway_rest_api_lib.html @@ -318,1101 +318,1106 @@
41class AirlockGatewayRestError(Exception): -42 ''' -43 Custom Exception to inform Library users that an unexpected status -44 has been returbned by the performed REST call. -45 ''' -46 def __init__(self, status_code, message): -47 self.status_code = status_code -48 self.message = "Status code " + str(status_code) + ": " + message -49 super().__init__(self.message) +@@ -1455,10 +1461,10 @@43class AirlockGatewayRestError(Exception): +44 ''' +45 Custom Exception to inform Library users that an unexpected status +46 has been returbned by the performed REST call. +47 ''' +48 +49 def __init__(self, status_code, message): +50 self.status_code = status_code +51 self.message = "Status code " + str(status_code) + ": " + message +52 super().__init__(self.message)
46 def __init__(self, status_code, message): -47 self.status_code = status_code -48 self.message = "Status code " + str(status_code) + ": " + message -49 super().__init__(self.message) +@@ -1486,34 +1492,35 @@49 def __init__(self, status_code, message): +50 self.status_code = status_code +51 self.message = "Status code " + str(status_code) + ": " + message +52 super().__init__(self.message)Inherited Members
52class GatewaySession: -53 '''Wrapper class for a REST Session with Airlock Gateway. -54 -55 Uses the `requests` Python library to perform HTTP. -56 ''' -57 def __init__(self, host_name: str, ses: Session, port: int = None): -58 self.port = port if port else 443 -59 self.host = f"{host_name}:{port}" if port != 443 else host_name -60 self.host_name = host_name -61 self.ses = ses -62 host = None -63 host_name = None -64 port = 443 -65 ses = None -66 -67 def add_headers(self, headers: dict): -68 ''' -69 Adds the given `headers` to the REST Session.\n -70 If one of the given `headers` was already set, it will be -71 overwritten. -72 ''' -73 self.ses.headers.update(headers) -74 -75 def get_session(self) -> Session: -76 ''' -77 Returns the internal Session object of this object. -78 ''' -79 return self.ses +@@ -1533,11 +1540,11 @@55class GatewaySession: +56 '''Wrapper class for a REST Session with Airlock Gateway. +57 +58 Uses the `requests` Python library to perform HTTP. +59 ''' +60 +61 def __init__(self, host_name: str, ses: Session, port: int = None): +62 self.port = port if port else 443 +63 self.host = f"{host_name}:{port}" if port != 443 else host_name +64 self.host_name = host_name +65 self.ses = ses +66 host = None +67 host_name = None +68 port = 443 +69 ses = None +70 +71 def add_headers(self, headers: dict): +72 ''' +73 Adds the given `headers` to the REST Session.\n +74 If one of the given `headers` was already set, it will be +75 overwritten. +76 ''' +77 self.ses.headers.update(headers) +78 +79 def get_session(self) -> Session: +80 ''' +81 Returns the internal Session object of this object. +82 ''' +83 return self.sesInherited Members
57 def __init__(self, host_name: str, ses: Session, port: int = None): -58 self.port = port if port else 443 -59 self.host = f"{host_name}:{port}" if port != 443 else host_name -60 self.host_name = host_name -61 self.ses = ses +@@ -1555,13 +1562,13 @@61 def __init__(self, host_name: str, ses: Session, port: int = None): +62 self.port = port if port else 443 +63 self.host = f"{host_name}:{port}" if port != 443 else host_name +64 self.host_name = host_name +65 self.ses = sesInherited Members
67 def add_headers(self, headers: dict): -68 ''' -69 Adds the given `headers` to the REST Session.\n -70 If one of the given `headers` was already set, it will be -71 overwritten. -72 ''' -73 self.ses.headers.update(headers) +@@ -1584,11 +1591,11 @@71 def add_headers(self, headers: dict): +72 ''' +73 Adds the given `headers` to the REST Session.\n +74 If one of the given `headers` was already set, it will be +75 overwritten. +76 ''' +77 self.ses.headers.update(headers)Inherited Members
75 def get_session(self) -> Session: -76 ''' -77 Returns the internal Session object of this object. -78 ''' -79 return self.ses +@@ -1609,13 +1616,13 @@79 def get_session(self) -> Session: +80 ''' +81 Returns the internal Session object of this object. +82 ''' +83 return self.sesInherited Members
82def get_version(gw_session: GatewaySession) -> Union[str, None]: -83 ''' -84 Returns the major and minor realease number (for example 8.0) of the -85 Airlock Host, or None if the version could not be retrieved.\n -86 ''' -87 res = get(gw_session, "/system/status/node", exp_code=200) -88 return res.json()["data"]["attributes"].get("version") +@@ -1636,24 +1643,24 @@86def get_version(gw_session: GatewaySession) -> Union[str, None]: +87 ''' +88 Returns the major and minor realease number (for example 8.0) of the +89 Airlock Host, or None if the version could not be retrieved.\n +90 ''' +91 res = get(gw_session, "/system/status/node", exp_code=200) +92 return res.json()["data"]["attributes"].get("version")Inherited Members
105def req_raw(gw_session: GatewaySession, method: str, path: str, -106 ctype: str = None, data=None, -107 exp_code: Union[list, int] = None) -> Response: -108 ''' -109 Performs a request to the Airlock Host at the specified path -110 with the given method. Optionally, the Content Type, payload and -111 expected response status codes can be specified.\n -112 Returns the response object to the performed request. -113 ''' -114 uri = f'https://{gw_session.host}/airlock/rest{path}' -115 logging.info("Performing a %s request at URI: %s", method, uri) -116 headers = None -117 if ctype: -118 headers = {'Content-Type': ctype} -119 res = gw_session.ses.request(method, uri, data=data, headers=headers, -120 verify=False) -121 _res_expect_handle(res, exp_code) -122 return res +@@ -1677,23 +1684,23 @@110def req_raw(gw_session: GatewaySession, method: str, path: str, +111 ctype: str = None, data=None, +112 exp_code: Union[list, int] = None) -> Response: +113 ''' +114 Performs a request to the Airlock Host at the specified path +115 with the given method. Optionally, the Content Type, payload and +116 expected response status codes can be specified.\n +117 Returns the response object to the performed request. +118 ''' +119 uri = f'https://{gw_session.host}/airlock/rest{path}' +120 logging.info("Performing a %s request at URI: %s", method, uri) +121 headers = None +122 if ctype: +123 headers = {'Content-Type': ctype} +124 res = gw_session.ses.request(method, uri, data=data, headers=headers, +125 verify=False) +126 _res_expect_handle(res, exp_code) +127 return resInherited Members
125def req(gw_session: GatewaySession, method: str, -126 path: str, body_dict: dict = None, -127 exp_code: Union[list, int] = None) -> Response: -128 ''' -129 Performs a request to the Airlock Host at the specified path -130 with the given method. Optionally, the JSON payload and -131 expected response status codes can be specified.\n -132 Returns the response object to the performed request. -133 ''' -134 uri = f'https://{gw_session.host}/airlock/rest{path}' -135 logging.info("Performing a %s request at URI: %s ", method, uri) -136 if isinstance(body_dict, dict): -137 logging.debug("JSON payload of request:") -138 logging.debug(json.dumps(body_dict, indent=4)) -139 res = gw_session.ses.request(method, uri, json=body_dict) -140 _res_expect_handle(res, exp_code) -141 return res +@@ -1717,15 +1724,15 @@130def req(gw_session: GatewaySession, method: str, +131 path: str, body_dict: dict = None, +132 exp_code: Union[list, int] = None) -> Response: +133 ''' +134 Performs a request to the Airlock Host at the specified path +135 with the given method. Optionally, the JSON payload and +136 expected response status codes can be specified.\n +137 Returns the response object to the performed request. +138 ''' +139 uri = f'https://{gw_session.host}/airlock/rest{path}' +140 logging.info("Performing a %s request at URI: %s ", method, uri) +141 if isinstance(body_dict, dict): +142 logging.debug("JSON payload of request:") +143 logging.debug(json.dumps(body_dict, indent=4)) +144 res = gw_session.ses.request(method, uri, json=body_dict) +145 _res_expect_handle(res, exp_code) +146 return resInherited Members
144def post(gw_session: GatewaySession, path: str, body_dict: dict = None, -145 exp_code: Union[list, int] = None) -> Response: -146 ''' -147 Performs a POST request to the Airlock Host at the specified path. -148 Optionally, the JSON payload and expected response status codes -149 can be specified.\n -150 Returns the Response object to the performed request. -151 ''' -152 return req(gw_session, 'POST', path, body_dict, exp_code) +@@ -1749,15 +1756,15 @@149def post(gw_session: GatewaySession, path: str, body_dict: dict = None, +150 exp_code: Union[list, int] = None) -> Response: +151 ''' +152 Performs a POST request to the Airlock Host at the specified path. +153 Optionally, the JSON payload and expected response status codes +154 can be specified.\n +155 Returns the Response object to the performed request. +156 ''' +157 return req(gw_session, 'POST', path, body_dict, exp_code)Inherited Members
155def patch(gw_session: GatewaySession, path: str, body_dict: dict, -156 exp_code: Union[list, int] = None) -> Response: -157 ''' -158 Performs a PATCH request to the Airlock Host at the specified path. -159 Optionally, the JSON payload and expected response status codes -160 can be specified.\n -161 Returns the Response object to the performed request. -162 ''' -163 return req(gw_session, 'PATCH', path, body_dict, exp_code) +@@ -1781,15 +1788,15 @@160def patch(gw_session: GatewaySession, path: str, body_dict: dict, +161 exp_code: Union[list, int] = None) -> Response: +162 ''' +163 Performs a PATCH request to the Airlock Host at the specified path. +164 Optionally, the JSON payload and expected response status codes +165 can be specified.\n +166 Returns the Response object to the performed request. +167 ''' +168 return req(gw_session, 'PATCH', path, body_dict, exp_code)Inherited Members
166def put(gw_session: GatewaySession, path: str, body_dict: dict, -167 exp_code: Union[list, int] = None) -> Response: -168 ''' -169 Performs a PUT request to the Airlock Host at the specified path. -170 Optionally, the JSON payload and expected response status codes -171 can be specified.\n -172 Returns the Response object to the performed request. -173 ''' -174 return req(gw_session, 'PUT', path, body_dict, exp_code) +@@ -1813,14 +1820,14 @@171def put(gw_session: GatewaySession, path: str, body_dict: dict, +172 exp_code: Union[list, int] = None) -> Response: +173 ''' +174 Performs a PUT request to the Airlock Host at the specified path. +175 Optionally, the JSON payload and expected response status codes +176 can be specified.\n +177 Returns the Response object to the performed request. +178 ''' +179 return req(gw_session, 'PUT', path, body_dict, exp_code)Inherited Members
177def delete(gw_session: GatewaySession, path: str, body_dict: dict = None, -178 exp_code: Union[list, int] = None) -> Response: -179 ''' -180 Performs a DELETE request to the Airlock Host at the specified path. -181 Optionally, the expected response status codes can be specified.\n -182 Returns the Response object to the performed request. -183 ''' -184 return req(gw_session, 'DELETE', path, body_dict, exp_code) +@@ -1843,14 +1850,14 @@182def delete(gw_session: GatewaySession, path: str, body_dict: dict = None, +183 exp_code: Union[list, int] = None) -> Response: +184 ''' +185 Performs a DELETE request to the Airlock Host at the specified path. +186 Optionally, the expected response status codes can be specified.\n +187 Returns the Response object to the performed request. +188 ''' +189 return req(gw_session, 'DELETE', path, body_dict, exp_code)Inherited Members
187def get(gw_session: GatewaySession, path: str, -188 exp_code: Union[list, int] = None) -> Response: -189 ''' -190 Performs a GET request to the Airlock Host at the specified path. -191 Optionally, the expected response status codes can be specified.\n -192 Returns the Response object to the performed request. -193 ''' -194 return req(gw_session, 'GET', path, None, exp_code) +@@ -1873,32 +1880,32 @@192def get(gw_session: GatewaySession, path: str, +193 exp_code: Union[list, int] = None) -> Response: +194 ''' +195 Performs a GET request to the Airlock Host at the specified path. +196 Optionally, the expected response status codes can be specified.\n +197 Returns the Response object to the performed request. +198 ''' +199 return req(gw_session, 'GET', path, None, exp_code)Inherited Members
197def create_session(host: str, api_key: str, port: int = 443) -> GatewaySession: -198 ''' -199 Creates a new session with the given host. -200 -201 Returns the generated GatewaySession object, -202 or None if the Session couldn't be started. -203 ''' -204 ses = requests.Session() -205 ses.verify = False -206 gw_session = GatewaySession(host, ses, port) -207 gw_session.add_headers({"Authorization": f"Bearer {api_key}"}) -208 logging.info("Starting the REST Session with Host %s", host) -209 res = post(gw_session, "/session/create", exp_code=[200, 404]) -210 if res.status_code == 200: -211 version = get_version(gw_session) -212 if version: -213 if not version.startswith(LIBRARY_COMPATIBILITY_VERSION): -214 logging.warning("You are using Airlock version %s while this \ -215library version is developed for Airlock hosts running version %s. Some Rest \ -216calls will not work on this Airlock version", version, -217 LIBRARY_COMPATIBILITY_VERSION) -218 else: -219 logging.warning('The Airlock version could not be determined, \ -220this library version might be incompatible with this Airlock Host') -221 return gw_session -222 return None +@@ -1921,16 +1928,16 @@202def create_session(host: str, api_key: str, port: int = 443) -> GatewaySession: +203 ''' +204 Creates a new session with the given host. +205 +206 Returns the generated GatewaySession object, +207 or None if the Session couldn't be started. +208 ''' +209 ses = requests.Session() +210 ses.verify = False +211 gw_session = GatewaySession(host, ses, port) +212 gw_session.add_headers({"Authorization": f"Bearer {api_key}"}) +213 logging.info("Starting the REST Session with Host %s", host) +214 res = post(gw_session, "/session/create", exp_code=[200, 404]) +215 if res.status_code == 200: +216 version = get_version(gw_session) +217 if version: +218 if not version.startswith(LIBRARY_COMPATIBILITY_VERSION): +219 logging.warning("You are using Airlock version %s while this \ +220library version is developed for Airlock hosts running version %s. Some Rest \ +221calls will not work on this Airlock version", version, +222 LIBRARY_COMPATIBILITY_VERSION) +223 else: +224 logging.warning('The Airlock version could not be determined, \ +225this library version might be incompatible with this Airlock Host') +226 return gw_session +227 return NoneInherited Members
245def get_jsession_id(gw_session: GatewaySession) -> str: -246 ''' -247 Returns the value of the JSESSIONID Cookie, -248 or None if no such Cookie was found. -249 ''' -250 cookie = _get_cookies(gw_session).get('JSESSIONID') -251 return cookie.value if cookie else None +@@ -1979,11 +1986,11 @@250def get_jsession_id(gw_session: GatewaySession) -> str: +251 ''' +252 Returns the value of the JSESSIONID Cookie, +253 or None if no such Cookie was found. +254 ''' +255 cookie = _get_cookies(gw_session).get('JSESSIONID') +256 return cookie.value if cookie else NoneInherited Members
254def terminate_session(gw_session: GatewaySession) -> None: -255 ''' -256 Terminates the Gateway Session. -257 ''' -258 post(gw_session, "/session/terminate", exp_code=200) +@@ -2003,13 +2010,13 @@259def terminate_session(gw_session: GatewaySession) -> None: +260 ''' +261 Terminates the Gateway Session. +262 ''' +263 post(gw_session, "/session/terminate", exp_code=200)Inherited Members
261def get_configs(gw_session: GatewaySession) -> list: -262 ''' -263 Returns a list containing all configurations on the -264 Airlock Host as dictionary objects. -265 ''' -266 res = get(gw_session, "/configuration/configurations", exp_code=200) -267 return res.json()["data"] +@@ -2030,20 +2037,20 @@266def get_configs(gw_session: GatewaySession) -> list: +267 ''' +268 Returns a list containing all configurations on the +269 Airlock Host as dictionary objects. +270 ''' +271 res = get(gw_session, "/configuration/configurations", exp_code=200) +272 return res.json()["data"]Inherited Members
270def validate(gw_session: GatewaySession) -> Tuple[bool, list]: -271 ''' -272 Returns True and an empty list if the configuration is valid, -273 False and a list of error messages if it isn't. -274 ''' -275 path = "/configuration/validator-messages?filter=meta.severity==ERROR" -276 res = get(gw_session, path, exp_code=200) -277 rdata = res.json() -278 if len(rdata["data"]) > 0: -279 msgs = [e["attributes"]["detail"] for e in rdata["data"]] -280 logging.info("Validation failed with the following error\ -281 message(s):\n %s", str(msgs)) -282 return False, msgs -283 return True, [] +@@ -2064,24 +2071,24 @@275def validate(gw_session: GatewaySession) -> Tuple[bool, list]: +276 ''' +277 Returns True and an empty list if the configuration is valid, +278 False and a list of error messages if it isn't. +279 ''' +280 path = "/configuration/validator-messages?filter=meta.severity==ERROR" +281 res = get(gw_session, path, exp_code=200) +282 rdata = res.json() +283 if len(rdata["data"]) > 0: +284 msgs = [e["attributes"]["detail"] for e in rdata["data"]] +285 logging.info("Validation failed with the following error\ +286 message(s):\n %s", str(msgs)) +287 return False, msgs +288 return True, []Inherited Members
286def activate(gw_session: GatewaySession, comment: str = None) -> bool: -287 ''' -288 Activates the currently loaded configuration on Airlock Host and -289 optionally adds a comment to the activation.\n -290 Returns True if the configuration was activated successfully and False -291 otherwise -292 ''' -293 data = None -294 if comment: -295 options = {"ignoreOutdatedConfiguration": True, -296 "failoverActivation": False} -297 data = {"comment": comment, "options": options} -298 if not validate(gw_session)[0]: -299 logging.info("Configuration could not be activated as it isn't valid") -300 return False -301 path = "/configuration/configurations/activate" -302 post(gw_session, path, data, 200) -303 return True +@@ -2105,23 +2112,23 @@291def activate(gw_session: GatewaySession, comment: str = None) -> bool: +292 ''' +293 Activates the currently loaded configuration on Airlock Host and +294 optionally adds a comment to the activation.\n +295 Returns True if the configuration was activated successfully and False +296 otherwise +297 ''' +298 data = None +299 if comment: +300 options = {"ignoreOutdatedConfiguration": True, +301 "failoverActivation": False} +302 data = {"comment": comment, "options": options} +303 if not validate(gw_session)[0]: +304 logging.info("Configuration could not be activated as it isn't valid") +305 return False +306 path = "/configuration/configurations/activate" +307 post(gw_session, path, data, 200) +308 return TrueInherited Members
306def save_config(gw_session: GatewaySession, comment: str = None) -> str: -307 ''' -308 Saves the current configuration with an optional -309 `comment` without activating it.\n -310 Returns the ID of the newly saved configuration or None if -311 the configuration could not be saved. -312 ''' -313 data = None -314 if comment: -315 data = {"comment": comment} -316 path = "/configuration/configurations/save" -317 res = post(gw_session, path, data, [200, 400]) -318 if res.status_code == 400: -319 logging.warning("Configuration could not be saved\ -320 as no configuration was loaded!") -321 return None -322 return res.json()['data']['id'] +@@ -2145,22 +2152,22 @@311def save_config(gw_session: GatewaySession, comment: str = None) -> str: +312 ''' +313 Saves the current configuration with an optional +314 `comment` without activating it.\n +315 Returns the ID of the newly saved configuration or None if +316 the configuration could not be saved. +317 ''' +318 data = None +319 if comment: +320 data = {"comment": comment} +321 path = "/configuration/configurations/save" +322 res = post(gw_session, path, data, [200, 400]) +323 if res.status_code == 400: +324 logging.warning("Configuration could not be saved\ +325 as no configuration was loaded!") +326 return None +327 return res.json()['data']['id']Inherited Members
325def update_license(gw_session: GatewaySession, lic_str: str) -> None: -326 ''' -327 Updates the license on the Airlock Host. -328 ''' -329 res = get(gw_session, '/configuration/license') -330 logging.debug("Current license: \n %s", json.dumps(res.json(), indent=4)) -331 -332 lic_patch_data = { -333 "data": { -334 "type": "license", -335 "attributes": { -336 "license": lic_str -337 } -338 } -339 } -340 patch(gw_session, "/configuration/license", lic_patch_data, 200) +@@ -2180,13 +2187,13 @@330def update_license(gw_session: GatewaySession, lic_str: str) -> None: +331 ''' +332 Updates the license on the Airlock Host. +333 ''' +334 res = get(gw_session, '/configuration/license') +335 logging.debug("Current license: \n %s", json.dumps(res.json(), indent=4)) +336 +337 lic_patch_data = { +338 "data": { +339 "type": "license", +340 "attributes": { +341 "license": lic_str +342 } +343 } +344 } +345 patch(gw_session, "/configuration/license", lic_patch_data, 200)Inherited Members
343def get_virtualhosts(gw_session: GatewaySession) -> list: -344 ''' -345 Returns a list of dictionary objects describing all -346 virtual hosts on the Airlock Host. -347 ''' -348 res = get(gw_session, '/configuration/virtual-hosts', exp_code=200) -349 return res.json().get('data') +@@ -2207,46 +2214,46 @@348def get_virtualhosts(gw_session: GatewaySession) -> list: +349 ''' +350 Returns a list of dictionary objects describing all +351 virtual hosts on the Airlock Host. +352 ''' +353 res = get(gw_session, '/configuration/virtual-hosts', exp_code=200) +354 return res.json().get('data')Inherited Members
352def gen_standard_virtual_host_data(vh_name: str, ipv4_addr: str, -353 interface: str, -354 certificate: dict) -> dict: -355 ''' -356 Generates and returns the data object necessary to upload a new virtual -357 host to the Airlock Host. This object can then for example be passed -358 to the `add_virtual_host()` function to add a new virtual host. \n -359 The virtual host data will have standard values for every attribute that -360 can not be given to this function as an argument. -361 ''' -362 host_data = { -363 "data": { -364 "type": "virtual-host", -365 "attributes": { -366 "name": vh_name, -367 "hostName": vh_name, -368 "serverAdmin": "admin@" + vh_name, -369 "showMaintenancePage": False, -370 "strictlyMatchFullyQualifiedDomainName": False, -371 "keepAliveTimeout": 10, -372 "networkInterface": { -373 "externalLogicalInterfaceName": interface, -374 "ipV4Address": ipv4_addr, -375 "ipV6Address": "", -376 "http": { -377 "enabled": True, -378 "port": 80, -379 "httpsRedirectEnforced": True -380 }, -381 "https": { +@@ -2271,16 +2278,16 @@357def gen_standard_virtual_host_data(vh_name: str, ipv4_addr: str, +358 interface: str, +359 certificate: dict) -> dict: +360 ''' +361 Generates and returns the data object necessary to upload a new virtual +362 host to the Airlock Host. This object can then for example be passed +363 to the `add_virtual_host()` function to add a new virtual host. \n +364 The virtual host data will have standard values for every attribute that +365 can not be given to this function as an argument. +366 ''' +367 host_data = { +368 "data": { +369 "type": "virtual-host", +370 "attributes": { +371 "name": vh_name, +372 "hostName": vh_name, +373 "serverAdmin": "admin@" + vh_name, +374 "showMaintenancePage": False, +375 "strictlyMatchFullyQualifiedDomainName": False, +376 "keepAliveTimeout": 10, +377 "networkInterface": { +378 "externalLogicalInterfaceName": interface, +379 "ipV4Address": ipv4_addr, +380 "ipV6Address": "", +381 "http": { 382 "enabled": True, -383 "port": 443, -384 "http2Allowed": True -385 } -386 }, -387 "tls": certificate, -388 } -389 } -390 } -391 return host_data +383 "port": 80, +384 "httpsRedirectEnforced": True +385 }, +386 "https": { +387 "enabled": True, +388 "port": 443, +389 "http2Allowed": True +390 } +391 }, +392 "tls": certificate, +393 } +394 } +395 } +396 return host_dataInherited Members
394def add_virtual_host(gw_session: GatewaySession, data: dict) -> str: -395 ''' -396 Adds a new virtual host to the Airlock Host. The `data` parameter -397 has to fully specify a valid virtual host configuration.\n -398 For standard virtual hosts configuration use -399 `add_standard_virtual_host()` instead.\n -400 Returns the ID of the added virtual host. -401 ''' -402 res = post(gw_session, "/configuration/virtual-hosts", data, 201) -403 return res.json()['data']['id'] +@@ -2306,17 +2313,17 @@399def add_virtual_host(gw_session: GatewaySession, data: dict) -> str: +400 ''' +401 Adds a new virtual host to the Airlock Host. The `data` parameter +402 has to fully specify a valid virtual host configuration.\n +403 For standard virtual hosts configuration use +404 `add_standard_virtual_host()` instead.\n +405 Returns the ID of the added virtual host. +406 ''' +407 res = post(gw_session, "/configuration/virtual-hosts", data, 201) +408 return res.json()['data']['id']Inherited Members
406def get_virtual_host_by_id(gw_session: GatewaySession, vh_id: str) -> dict: -407 ''' -408 Returns a dictionary object representing the virtual host with -409 the given `vh_id` or None if no such virtual host was found -410 ''' -411 path = f'/configuration/virtual-hosts/{vh_id}' -412 res = get(gw_session, path, exp_code=[200, 404]) -413 -414 if res.status_code == 404: -415 return None -416 return res.json().get('data') +@@ -2337,24 +2344,24 @@411def get_virtual_host_by_id(gw_session: GatewaySession, vh_id: str) -> dict: +412 ''' +413 Returns a dictionary object representing the virtual host with +414 the given `vh_id` or None if no such virtual host was found +415 ''' +416 path = f'/configuration/virtual-hosts/{vh_id}' +417 res = get(gw_session, path, exp_code=[200, 404]) +418 +419 if res.status_code == 404: +420 return None +421 return res.json().get('data')Inherited Members
419def update_virtual_host_by_id(gw_session: GatewaySession, vh_id: str, -420 attributes: dict) -> bool: -421 ''' -422 Updates the virtual host with ID `vh_id` with the given `attributes`, -423 for example name, showMaintenancePage etc.\n -424 Returns True if the update was successful and False if no virtual -425 host with ID `vh_id` was found. -426 ''' -427 host_data = { -428 "data": { -429 "type": "virtual-host", -430 "id": vh_id, -431 "attributes": attributes -432 } -433 } -434 path = f"/configuration/virtual-hosts/{vh_id}" -435 res = patch(gw_session, path, host_data, [200, 404]) -436 return res.status_code == 200 +@@ -2378,14 +2385,14 @@424def update_virtual_host_by_id(gw_session: GatewaySession, vh_id: str, +425 attributes: dict) -> bool: +426 ''' +427 Updates the virtual host with ID `vh_id` with the given `attributes`, +428 for example name, showMaintenancePage etc.\n +429 Returns True if the update was successful and False if no virtual +430 host with ID `vh_id` was found. +431 ''' +432 host_data = { +433 "data": { +434 "type": "virtual-host", +435 "id": vh_id, +436 "attributes": attributes +437 } +438 } +439 path = f"/configuration/virtual-hosts/{vh_id}" +440 res = patch(gw_session, path, host_data, [200, 404]) +441 return res.status_code == 200Inherited Members
439def delete_virtual_host_by_id(gw_session: GatewaySession, vh_id: str) -> bool: -440 ''' -441 Deletes the Virtual Host with the selected ID.\n -442 Returns True if deletion was successful and False otherwise. -443 ''' -444 path = f"/configuration/virtual-hosts/{vh_id}" -445 res = delete(gw_session, path, exp_code=[204, 404]) -446 return res.status_code == 204 +@@ -2407,13 +2414,13 @@444def delete_virtual_host_by_id(gw_session: GatewaySession, vh_id: str) -> bool: +445 ''' +446 Deletes the Virtual Host with the selected ID.\n +447 Returns True if deletion was successful and False otherwise. +448 ''' +449 path = f"/configuration/virtual-hosts/{vh_id}" +450 res = delete(gw_session, path, exp_code=[204, 404]) +451 return res.status_code == 204Inherited Members
449def get_all_mappings(gw_session: GatewaySession) -> list: -450 ''' -451 Returns a list of dictionary object describing -452 all mappings on the Airlock Host. -453 ''' -454 res = get(gw_session, '/configuration/mappings', 200) -455 return res.json().get('data') +@@ -2434,29 +2441,29 @@454def get_all_mappings(gw_session: GatewaySession) -> list: +455 ''' +456 Returns a list of dictionary object describing +457 all mappings on the Airlock Host. +458 ''' +459 res = get(gw_session, '/configuration/mappings', 200) +460 return res.json().get('data')Inherited Members
458def select_mappings(gw_session: GatewaySession, pattern: str = None, -459 label: str = None) -> list: -460 ''' -461 Returns a list of dictionary object describing all mappings -462 whose name is matched by the `pattern` regular expression -463 or who are labeled with `label`.\n -464 If no parameter is given, all mappings are returned. -465 ''' -466 if (not pattern and not label): -467 return get_all_mappings(gw_session) -468 if (pattern and label): -469 return list(set(select_mappings(gw_session, pattern=pattern)) -470 + set(select_mappings(gw_session, label=label)) -471 ) -472 if label: -473 path = f'/configuration/mappings?filter=label=={label}' -474 res = get(gw_session, path, exp_code=200) -475 return res.json().get('data') -476 mappings = [] -477 for mapping in get_all_mappings(gw_session): -478 if re.search(pattern, mapping['attributes']['name']): -479 mappings.append(mapping) -480 return mappings +@@ -2480,15 +2487,15 @@463def select_mappings(gw_session: GatewaySession, pattern: str = None, +464 label: str = None) -> list: +465 ''' +466 Returns a list of dictionary object describing all mappings +467 whose name is matched by the `pattern` regular expression +468 or who are labeled with `label`.\n +469 If no parameter is given, all mappings are returned. +470 ''' +471 if (not pattern and not label): +472 return get_all_mappings(gw_session) +473 if (pattern and label): +474 return list(set(select_mappings(gw_session, pattern=pattern)) +475 + set(select_mappings(gw_session, label=label)) +476 ) +477 if label: +478 path = f'/configuration/mappings?filter=label=={label}' +479 res = get(gw_session, path, exp_code=200) +480 return res.json().get('data') +481 mappings = [] +482 for mapping in get_all_mappings(gw_session): +483 if re.search(pattern, mapping['attributes']['name']): +484 mappings.append(mapping) +485 return mappingsInherited Members
483def get_mapping_id(gw_session: GatewaySession, name: str) -> str: -484 ''' -485 Returns the ID of the mapping with the given `name` -486 or None if no such mapping was found. -487 ''' -488 mapping = get_mapping_by_name(gw_session, name) -489 if mapping: -490 return mapping['id'] -491 return None +@@ -2509,17 +2516,17 @@488def get_mapping_id(gw_session: GatewaySession, name: str) -> str: +489 ''' +490 Returns the ID of the mapping with the given `name` +491 or None if no such mapping was found. +492 ''' +493 mapping = get_mapping_by_name(gw_session, name) +494 if mapping: +495 return mapping['id'] +496 return NoneInherited Members
494def get_mapping_by_id(gw_session: GatewaySession, mapping_id: str) -> dict: -495 ''' -496 Returns a dictionary object representing the mapping -497 with the given `mapping_id` or None if no such mapping -498 was found. -499 ''' -500 path = f'/configuration/mappings/{mapping_id}' -501 res = get(gw_session, path, exp_code=[200, 404]) -502 if res.status_code == 200: -503 return res.json().get('data') -504 return None +@@ -2541,15 +2548,15 @@499def get_mapping_by_id(gw_session: GatewaySession, mapping_id: str) -> dict: +500 ''' +501 Returns a dictionary object representing the mapping +502 with the given `mapping_id` or None if no such mapping +503 was found. +504 ''' +505 path = f'/configuration/mappings/{mapping_id}' +506 res = get(gw_session, path, exp_code=[200, 404]) +507 if res.status_code == 200: +508 return res.json().get('data') +509 return NoneInherited Members
507def get_mapping_by_name(gw_session: GatewaySession, name: str) -> dict: -508 ''' -509 Returns a dictionary object representing the mapping -510 with the given `name` or an empty dictionary if no -511 such mapping was found. -512 ''' -513 path = f'/configuration/mappings?filter=name=={name}' -514 res = get(gw_session, path, exp_code=200) -515 return res.json().get('data') +@@ -2571,16 +2578,16 @@512def get_mapping_by_name(gw_session: GatewaySession, name: str) -> dict: +513 ''' +514 Returns a dictionary object representing the mapping +515 with the given `name` or an empty dictionary if no +516 such mapping was found. +517 ''' +518 path = f'/configuration/mappings?filter=name=={name}' +519 res = get(gw_session, path, exp_code=200) +520 return res.json().get('data')Inherited Members
518def get_all_mapping_names(gw_session: GatewaySession) -> list: -519 ''' -520 Returns a sorted list of all mapping names on the Airlock Host. -521 ''' -522 mappings = get_all_mappings(gw_session) -523 mapping_names = [] -524 for mapping in mappings: -525 mapping_name = mapping["attributes"]["name"] -526 mapping_names.append(mapping_name) -527 return sorted(mapping_names) +@@ -2600,22 +2607,22 @@523def get_all_mapping_names(gw_session: GatewaySession) -> list: +524 ''' +525 Returns a sorted list of all mapping names on the Airlock Host. +526 ''' +527 mappings = get_all_mappings(gw_session) +528 mapping_names = [] +529 for mapping in mappings: +530 mapping_name = mapping["attributes"]["name"] +531 mapping_names.append(mapping_name) +532 return sorted(mapping_names)Inherited Members
530def import_mappings_from_xml(gw_session, mappings_xmls: list): -531 ''' -532 Adds all mappings specified in the list of dictionary objects -533 representing XML files stored in `mappings_xmls` on the -534 Airlock Host. If a mapping with the same name already exists, -535 it will be overwritten. -536 ''' -537 for mapping_xml in mappings_xmls: -538 mapping_zip = BytesIO() -539 with ZipFile(mapping_zip, mode="w") as zip_file: -540 zip_file.writestr("alec_table.xml", mapping_xml) -541 -542 mapping_zip.seek(0) -543 -544 req_raw(gw_session, "put", "/configuration/mappings/import", -545 "application/zip", mapping_zip.read(), 200) +@@ -2638,33 +2645,33 @@535def import_mappings_from_xml(gw_session, mappings_xmls: list): +536 ''' +537 Adds all mappings specified in the list of dictionary objects +538 representing XML files stored in `mappings_xmls` on the +539 Airlock Host. If a mapping with the same name already exists, +540 it will be overwritten. +541 ''' +542 for mapping_xml in mappings_xmls: +543 mapping_zip = BytesIO() +544 with ZipFile(mapping_zip, mode="w") as zip_file: +545 zip_file.writestr("alec_table.xml", mapping_xml) +546 +547 mapping_zip.seek(0) +548 +549 req_raw(gw_session, "put", "/configuration/mappings/import", +550 "application/zip", mapping_zip.read(), 200)Inherited Members
548def export_mappings(gw_session: GatewaySession, -549 mapping_ids: list = None) -> list: -550 ''' -551 Returns a list of the XML files describing the mappings with IDs -552 contained in the `mapping_ids` list.\n -553 `mapping_ids` must be a list of strings. If it is omitted, all mappings -554 are returned. \n -555 If one or more of the mappings IDs is not found, it is ignored. -556 ''' -557 if mapping_ids is None: -558 mapping_ids = [data["id"] for data in get_all_mappings(gw_session)] -559 -560 mapping_xmls = [] -561 for mapping_id in mapping_ids: -562 gw_session.add_headers({"Accept": "application/zip"}) -563 path = f'/configuration/mappings/{mapping_id}/export' -564 res = get(gw_session, path, exp_code=[200, 404]) -565 if res.status_code == 200: -566 with ZipFile(BytesIO(res.content)) as zip_file: -567 with zip_file.open("alec_table.xml", "r") as mapping_xml: -568 mapping_xmls.append(mapping_xml) -569 else: -570 logging.info("Mapping with ID %s was not found on Airlock Host", -571 mapping_id) -572 -573 gw_session.add_headers({"Accept": "application/json"}) -574 return mapping_xmls +@@ -2690,15 +2697,15 @@553def export_mappings(gw_session: GatewaySession, +554 mapping_ids: list = None) -> list: +555 ''' +556 Returns a list of the XML files describing the mappings with IDs +557 contained in the `mapping_ids` list.\n +558 `mapping_ids` must be a list of strings. If it is omitted, all mappings +559 are returned. \n +560 If one or more of the mappings IDs is not found, it is ignored. +561 ''' +562 if mapping_ids is None: +563 mapping_ids = [data["id"] for data in get_all_mappings(gw_session)] +564 +565 mapping_xmls = [] +566 for mapping_id in mapping_ids: +567 gw_session.add_headers({"Accept": "application/zip"}) +568 path = f'/configuration/mappings/{mapping_id}/export' +569 res = get(gw_session, path, exp_code=[200, 404]) +570 if res.status_code == 200: +571 with ZipFile(BytesIO(res.content)) as zip_file: +572 with zip_file.open("alec_table.xml", "r") as mapping_xml: +573 mapping_xmls.append(mapping_xml) +574 else: +575 logging.info("Mapping with ID %s was not found on Airlock Host", +576 mapping_id) +577 +578 gw_session.add_headers({"Accept": "application/json"}) +579 return mapping_xmlsInherited Members
577def delete_mapping_by_id(gw_session: GatewaySession, mapping_id: str) -> bool: -578 ''' -579 Deletes the Mapping with the selected ID.\n -580 Returns True if deletion was successful and False if no mapping with ID -581 `mapping_id` was found.. -582 ''' -583 path = f"/configuration/mappings/{mapping_id}" -584 res = delete(gw_session, path, exp_code=[204, 404]) -585 return res.status_code == 204 +@@ -2721,13 +2728,13 @@582def delete_mapping_by_id(gw_session: GatewaySession, mapping_id: str) -> bool: +583 ''' +584 Deletes the Mapping with the selected ID.\n +585 Returns True if deletion was successful and False if no mapping with ID +586 `mapping_id` was found.. +587 ''' +588 path = f"/configuration/mappings/{mapping_id}" +589 res = delete(gw_session, path, exp_code=[204, 404]) +590 return res.status_code == 204Inherited Members
588def get_templates(gw_session: GatewaySession) -> dict: -589 ''' -590 Returns a dictionary object mapping every mapping template name to its ID. -591 ''' -592 res = get(gw_session, '/configuration/templates/mappings', 200) -593 data = res.json()['data'] -594 return {x['attributes']['name']: x['id'] for x in data} +@@ -2747,23 +2754,23 @@593def get_templates(gw_session: GatewaySession) -> dict: +594 ''' +595 Returns a dictionary object mapping every mapping template name to its ID. +596 ''' +597 res = get(gw_session, '/configuration/templates/mappings', 200) +598 data = res.json()['data'] +599 return {x['attributes']['name']: x['id'] for x in data}Inherited Members
597def update_mapping(gw_session: GatewaySession, mapping_id: str, -598 attributes: dict) -> bool: -599 ''' -600 Updates the mapping with ID `mapping_id` with the given `attributes`, -601 for example name or entry path.\n -602 Returns True if update was successful and False if no mapping with ID -603 `mapping_id` was found. -604 ''' -605 data = { -606 "data": { -607 "type": 'mapping', -608 "attributes": attributes -609 } -610 } -611 path = f'/configuration/mappings/{mapping_id}' -612 res = patch(gw_session, path, data, [200, 404]) -613 return res.status_code == 200 +@@ -2787,32 +2794,32 @@602def update_mapping(gw_session: GatewaySession, mapping_id: str, +603 attributes: dict) -> bool: +604 ''' +605 Updates the mapping with ID `mapping_id` with the given `attributes`, +606 for example name or entry path.\n +607 Returns True if update was successful and False if no mapping with ID +608 `mapping_id` was found. +609 ''' +610 data = { +611 "data": { +612 "type": 'mapping', +613 "attributes": attributes +614 } +615 } +616 path = f'/configuration/mappings/{mapping_id}' +617 res = patch(gw_session, path, data, [200, 404]) +618 return res.status_code == 200Inherited Members
616def add_mapping(gw_session: GatewaySession, name: str, -617 template: str = 'New_Mapping', entry_path: str = '/') -> str: -618 ''' -619 Adds a new mapping to the Airlock host, with the specified -620 `name` and `entry_path`.\n Optionally, a template can -621 be used for the new mapping.\n -622 Returns the mapping ID of the new mapping. -623 ''' -624 templates = get_templates(gw_session) -625 data = { -626 "data": { -627 "type": "create-mapping-from-template", -628 "attributes": { -629 "id": templates[template] -630 } -631 } -632 } -633 path = '/configuration/mappings/create-from-template' -634 res = post(gw_session, path, data, 201) -635 mapping_id = res.json()['data']['id'] -636 attributes = { -637 "name": name, -638 "entryPath": {"value": entry_path} -639 } -640 update_mapping(gw_session, mapping_id, attributes) -641 return mapping_id +@@ -2837,32 +2844,32 @@621def add_mapping(gw_session: GatewaySession, name: str, +622 template: str = 'New_Mapping', entry_path: str = '/') -> str: +623 ''' +624 Adds a new mapping to the Airlock host, with the specified +625 `name` and `entry_path`.\n Optionally, a template can +626 be used for the new mapping.\n +627 Returns the mapping ID of the new mapping. +628 ''' +629 templates = get_templates(gw_session) +630 data = { +631 "data": { +632 "type": "create-mapping-from-template", +633 "attributes": { +634 "id": templates[template] +635 } +636 } +637 } +638 path = '/configuration/mappings/create-from-template' +639 res = post(gw_session, path, data, 201) +640 mapping_id = res.json()['data']['id'] +641 attributes = { +642 "name": name, +643 "entryPath": {"value": entry_path} +644 } +645 update_mapping(gw_session, mapping_id, attributes) +646 return mapping_idInherited Members
644def set_source_mapping(gw_session: GatewaySession, mapping_id: str, -645 src_mapping_id: str) -> bool: -646 ''' -647 Sets the source mapping of mapping with ID `mapping_id` -648 to the mapping with ID `src_mapping_id`. \n -649 Returns True if the operation was successful and False if -650 no mapping with ID `mapping_id` was found. -651 ''' -652 data = { -653 "data": { -654 "type": 'mapping', -655 "id": src_mapping_id -656 } -657 } -658 path = f'/configuration/mappings/{mapping_id}/relationships/template' -659 res = patch(gw_session, path, data, [204, 404]) -660 if res.status_code == 404: -661 return False -662 -663 lock_cfg = { -664 "enabled": True, -665 "labels": True, -666 "entryPath": {"settings": True} -667 } -668 -669 return update_mapping(gw_session, mapping_id, {"locking": lock_cfg}) +@@ -2886,17 +2893,17 @@649def set_source_mapping(gw_session: GatewaySession, mapping_id: str, +650 src_mapping_id: str) -> bool: +651 ''' +652 Sets the source mapping of mapping with ID `mapping_id` +653 to the mapping with ID `src_mapping_id`. \n +654 Returns True if the operation was successful and False if +655 no mapping with ID `mapping_id` was found. +656 ''' +657 data = { +658 "data": { +659 "type": 'mapping', +660 "id": src_mapping_id +661 } +662 } +663 path = f'/configuration/mappings/{mapping_id}/relationships/template' +664 res = patch(gw_session, path, data, [204, 404]) +665 if res.status_code == 404: +666 return False +667 +668 lock_cfg = { +669 "enabled": True, +670 "labels": True, +671 "entryPath": {"settings": True} +672 } +673 +674 return update_mapping(gw_session, mapping_id, {"locking": lock_cfg})Inherited Members
672def pull_from_source_mapping(gw_session: GatewaySession, -673 mapping_id: str) -> bool: -674 ''' -675 Performs a pull from the source mapping on the mapping with -676 ID `mapping_id`.\n -677 Returns True if the pull was succesfull and False if no mapping with ID -678 `mapping_id` was found. -679 ''' -680 path = f'/configuration/mappings/{mapping_id}/pull-from-source-mapping' -681 res = post(gw_session, path, exp_code=[200, 404]) -682 return res.status_code == 200 +@@ -2920,16 +2927,16 @@677def pull_from_source_mapping(gw_session: GatewaySession, +678 mapping_id: str) -> bool: +679 ''' +680 Performs a pull from the source mapping on the mapping with +681 ID `mapping_id`.\n +682 Returns True if the pull was succesfull and False if no mapping with ID +683 `mapping_id` was found. +684 ''' +685 path = f'/configuration/mappings/{mapping_id}/pull-from-source-mapping' +686 res = post(gw_session, path, exp_code=[200, 404]) +687 return res.status_code == 200Inherited Members
685def gen_backend_host(protocol: str, name: str, port: int) -> dict: -686 ''' -687 Returns a dictionary object representing a new Backend Host. -688 ''' -689 host_data = { -690 "protocol": protocol, -691 "hostName": name, -692 "port": port -693 } -694 return host_data +@@ -2949,24 +2956,24 @@690def gen_backend_host(protocol: str, name: str, port: int) -> dict: +691 ''' +692 Returns a dictionary object representing a new Backend Host. +693 ''' +694 host_data = { +695 "protocol": protocol, +696 "hostName": name, +697 "port": port +698 } +699 return host_dataInherited Members
697def add_backend_group(gw_session: GatewaySession, beg_name: str, -698 be_hosts: list) -> str: -699 ''' -700 Adds a new Backend Group with the name `beg_name` and the hosts -701 contained in `be_hosts` to the Airlock Host.\n -702 Returns the ID of the newly added Backend Group. -703 ''' -704 beg_data = { -705 "data": { -706 "type": "back-end-group", -707 "attributes": { -708 "name": beg_name, -709 "backendHosts": be_hosts -710 } -711 } -712 } -713 res = post(gw_session, "/configuration/back-end-groups", beg_data, 201) -714 return res.json()['data']['id'] +@@ -2989,12 +2996,12 @@702def add_backend_group(gw_session: GatewaySession, beg_name: str, +703 be_hosts: list) -> str: +704 ''' +705 Adds a new Backend Group with the name `beg_name` and the hosts +706 contained in `be_hosts` to the Airlock Host.\n +707 Returns the ID of the newly added Backend Group. +708 ''' +709 beg_data = { +710 "data": { +711 "type": "back-end-group", +712 "attributes": { +713 "name": beg_name, +714 "backendHosts": be_hosts +715 } +716 } +717 } +718 res = post(gw_session, "/configuration/back-end-groups", beg_data, 201) +719 return res.json()['data']['id']Inherited Members
717def get_backend_groups(gw_session: GatewaySession) -> list: -718 ''' -719 Returns a list containing all backend groups on the Airlock Host. -720 ''' -721 res = get(gw_session, '/configuration/back-end-groups', exp_code=200) -722 return res.json().get('data') +@@ -3014,16 +3021,16 @@722def get_backend_groups(gw_session: GatewaySession) -> list: +723 ''' +724 Returns a list containing all backend groups on the Airlock Host. +725 ''' +726 res = get(gw_session, '/configuration/back-end-groups', exp_code=200) +727 return res.json().get('data')Inherited Members
725def get_backend_group_by_id(gw_session: GatewaySession, beg_id: str) -> dict: -726 ''' -727 Returns a dictionary object describing the backend group with ID -728 `beg_id`, or None if no such group was found. -729 ''' -730 path = f'/configuration/back-end-groups/{beg_id}' -731 res = get(gw_session, path, exp_code=[200, 404]) -732 if res.status_code == 200: -733 return res.json().get('data') -734 return None +@@ -3044,24 +3051,24 @@730def get_backend_group_by_id(gw_session: GatewaySession, beg_id: str) -> dict: +731 ''' +732 Returns a dictionary object describing the backend group with ID +733 `beg_id`, or None if no such group was found. +734 ''' +735 path = f'/configuration/back-end-groups/{beg_id}' +736 res = get(gw_session, path, exp_code=[200, 404]) +737 if res.status_code == 200: +738 return res.json().get('data') +739 return NoneInherited Members
737def update_backend_group_by_id(gw_session: GatewaySession, beg_id: str, -738 attributes: dict) -> bool: -739 ''' -740 Updates the Backend Group with ID `beg_id` with the given attributes, -741 for example hostname or port. \n -742 Returns True if the update was succesfull and False if no Backend Group -743 with ID `beg_id` was found. -744 ''' -745 beg_data = { -746 "data": { -747 "type": "back-end-group", -748 "id": beg_id, -749 "attributes": attributes -750 } -751 } -752 path = f"/configuration/back-end-groups/{beg_id}" -753 res = patch(gw_session, path, beg_data, [200, 404]) -754 return res.status_code == 200 +@@ -3085,16 +3092,16 @@742def update_backend_group_by_id(gw_session: GatewaySession, beg_id: str, +743 attributes: dict) -> bool: +744 ''' +745 Updates the Backend Group with ID `beg_id` with the given attributes, +746 for example hostname or port. \n +747 Returns True if the update was succesfull and False if no Backend Group +748 with ID `beg_id` was found. +749 ''' +750 beg_data = { +751 "data": { +752 "type": "back-end-group", +753 "id": beg_id, +754 "attributes": attributes +755 } +756 } +757 path = f"/configuration/back-end-groups/{beg_id}" +758 res = patch(gw_session, path, beg_data, [200, 404]) +759 return res.status_code == 200Inherited Members
757def delete_backend_group_by_id(gw_session: GatewaySession, -758 beg_id: str) -> bool: -759 ''' -760 Deletes the Backend Group with ID `beg_id` from the Airlock Host.\n -761 Returns True if deletion was successful and False if no Backend -762 Group with ID `beg_id` was found. -763 ''' -764 path = f"/configuration/back-end-groups/{beg_id}" -765 res = delete(gw_session, path, exp_code=[204, 404]) -766 return res.status_code == 204 +@@ -3117,22 +3124,22 @@762def delete_backend_group_by_id(gw_session: GatewaySession, +763 beg_id: str) -> bool: +764 ''' +765 Deletes the Backend Group with ID `beg_id` from the Airlock Host.\n +766 Returns True if deletion was successful and False if no Backend +767 Group with ID `beg_id` was found. +768 ''' +769 path = f"/configuration/back-end-groups/{beg_id}" +770 res = delete(gw_session, path, exp_code=[204, 404]) +771 return res.status_code == 204Inherited Members
769def connect_virtual_host_to_map(gw_session: GatewaySession, vh_id: str, -770 mapping_id: str) -> bool: -771 ''' -772 Connects Virtual Host with id `vh_id` to the Mapping with ID -773 `mapping_id`.\n Returns True if the operation was successful -774 and False if one of the provided IDs was not found. -775 ''' -776 data = { -777 "data": [{ -778 "type": 'mapping', -779 "id": mapping_id -780 }] -781 } -782 path = f'/configuration/virtual-hosts/{vh_id}/relationships/mappings' -783 res = patch(gw_session, path, data, [204, 404]) -784 return res.status_code == 204 +@@ -3155,27 +3162,27 @@774def connect_virtual_host_to_map(gw_session: GatewaySession, vh_id: str, +775 mapping_id: str) -> bool: +776 ''' +777 Connects Virtual Host with id `vh_id` to the Mapping with ID +778 `mapping_id`.\n Returns True if the operation was successful +779 and False if one of the provided IDs was not found. +780 ''' +781 data = { +782 "data": [{ +783 "type": 'mapping', +784 "id": mapping_id +785 }] +786 } +787 path = f'/configuration/virtual-hosts/{vh_id}/relationships/mappings' +788 res = patch(gw_session, path, data, [204, 404]) +789 return res.status_code == 204Inherited Members
787def connect_map_to_beg(gw_session: GatewaySession, mapping_id: str, -788 beg_ids: list) -> bool: -789 ''' -790 Connects Mapping with ID `mapping_id` to the Backend Groups -791 with IDs in `beg_ids`.\n -792 Returns True if the operation was successful and False if one of -793 the provided IDs was not found. -794 ''' -795 data = { -796 "data": [] -797 } -798 for beg_id in beg_ids: -799 group = { -800 "type": 'back-end-group', -801 "id": beg_id -802 } -803 data['data'].append(group) -804 map_id = mapping_id -805 path = f'/configuration/mappings/{map_id}/relationships/back-end-groups' -806 res = patch(gw_session, path, data, [204, 404]) -807 return res.status_code == 204 +@@ -3199,22 +3206,22 @@792def connect_map_to_beg(gw_session: GatewaySession, mapping_id: str, +793 beg_ids: list) -> bool: +794 ''' +795 Connects Mapping with ID `mapping_id` to the Backend Groups +796 with IDs in `beg_ids`.\n +797 Returns True if the operation was successful and False if one of +798 the provided IDs was not found. +799 ''' +800 data = { +801 "data": [] +802 } +803 for beg_id in beg_ids: +804 group = { +805 "type": 'back-end-group', +806 "id": beg_id +807 } +808 data['data'].append(group) +809 map_id = mapping_id +810 path = f'/configuration/mappings/{map_id}/relationships/back-end-groups' +811 res = patch(gw_session, path, data, [204, 404]) +812 return res.status_code == 204Inherited Members
810def disconnect_virtual_host_to_map(gw_session: GatewaySession, vh_id: str, -811 mapping_id: str) -> bool: -812 ''' -813 Disconnects Virtual Host with id `vh_id` to the Mapping with -814 ID `mapping_id`.\n Returns True if the operation was successful -815 and False if one of the provided IDs was not found. -816 ''' -817 data = { -818 "data": [{ -819 "type": 'mapping', -820 "id": mapping_id -821 }] -822 } -823 path = f'/configuration/virtual-hosts/{vh_id}/relationships/mappings' -824 res = delete(gw_session, path, data, [204, 404]) -825 return res.status_code == 204 +@@ -3237,26 +3244,26 @@815def disconnect_virtual_host_to_map(gw_session: GatewaySession, vh_id: str, +816 mapping_id: str) -> bool: +817 ''' +818 Disconnects Virtual Host with id `vh_id` to the Mapping with +819 ID `mapping_id`.\n Returns True if the operation was successful +820 and False if one of the provided IDs was not found. +821 ''' +822 data = { +823 "data": [{ +824 "type": 'mapping', +825 "id": mapping_id +826 }] +827 } +828 path = f'/configuration/virtual-hosts/{vh_id}/relationships/mappings' +829 res = delete(gw_session, path, data, [204, 404]) +830 return res.status_code == 204Inherited Members
828def disconnect_map_to_beg(gw_session: GatewaySession, mapping_id: str, -829 beg_ids: list) -> bool: -830 ''' -831 Disconnects Mapping with ID `mapping_id` from the Backend Groups -832 with IDs in `beg_ids`.\n Returns True if the operation was successful -833 and False if one of the provided IDs was not found. -834 ''' -835 data = { -836 "data": [] -837 } -838 for beg_id in beg_ids: -839 group = { -840 "type": 'back-end-group', -841 "id": beg_id -842 } -843 data['data'].append(group) -844 map_id = mapping_id -845 path = f'/configuration/mappings/{map_id}/relationships/back-end-groups' -846 res = delete(gw_session, path, data, [204, 404]) -847 return res.status_code == 204 +@@ -3279,16 +3286,16 @@833def disconnect_map_to_beg(gw_session: GatewaySession, mapping_id: str, +834 beg_ids: list) -> bool: +835 ''' +836 Disconnects Mapping with ID `mapping_id` from the Backend Groups +837 with IDs in `beg_ids`.\n Returns True if the operation was successful +838 and False if one of the provided IDs was not found. +839 ''' +840 data = { +841 "data": [] +842 } +843 for beg_id in beg_ids: +844 group = { +845 "type": 'back-end-group', +846 "id": beg_id +847 } +848 data['data'].append(group) +849 map_id = mapping_id +850 path = f'/configuration/mappings/{map_id}/relationships/back-end-groups' +851 res = delete(gw_session, path, data, [204, 404]) +852 return res.status_code == 204Inherited Members
850def get_mapping_deny_rule_group(gw_session: GatewaySession, mapping_id: str, -851 denyrule_group_shortname: str) -> dict: -852 ''' -853 Returns a dictionary object describing the deny rule group in the -854 specified Mapping, or None if the mapping or shortname specified were not -855 found. -856 ''' -857 path = f'/configuration/mappings/{mapping_id}/deny-rule-groups/{denyrule_group_shortname}' -858 res = get(gw_session, path, exp_code=[200, 404]) -859 return res.json().get('data') +@@ -3310,23 +3317,23 @@855def get_mapping_deny_rule_group(gw_session: GatewaySession, mapping_id: str, +856 denyrule_group_shortname: str) -> dict: +857 ''' +858 Returns a dictionary object describing the deny rule group in the +859 specified Mapping, or None if the mapping or shortname specified were not +860 found. +861 ''' +862 path = f'/configuration/mappings/{mapping_id}/deny-rule-groups/{denyrule_group_shortname}' +863 res = get(gw_session, path, exp_code=[200, 404]) +864 return res.json().get('data')Inherited Members
862def update_mapping_deny_rule_group(gw_session: GatewaySession, mapping_id: str, -863 denyrule_group_shortname: str, -864 attributes: dict) -> bool: -865 ''' -866 Updates the settings for a deny rule group within a specified mapping. -867 Returns True if successful, and False if if the mapping or shortname -868 specified were not found. -869 ''' -870 path = f'/configuration/mappings/{mapping_id}/deny-rule-groups/{denyrule_group_shortname}' -871 data = { -872 "data": { -873 "type": "mapping-deny-rule-group", -874 "attributes": attributes -875 } -876 } -877 res = patch(gw_session, path, data, exp_code=[200, 404]) -878 return res.status_code == 200 +@@ -3348,15 +3355,15 @@867def update_mapping_deny_rule_group(gw_session: GatewaySession, mapping_id: str, +868 denyrule_group_shortname: str, +869 attributes: dict) -> bool: +870 ''' +871 Updates the settings for a deny rule group within a specified mapping. +872 Returns True if successful, and False if if the mapping or shortname +873 specified were not found. +874 ''' +875 path = f'/configuration/mappings/{mapping_id}/deny-rule-groups/{denyrule_group_shortname}' +876 data = { +877 "data": { +878 "type": "mapping-deny-rule-group", +879 "attributes": attributes +880 } +881 } +882 res = patch(gw_session, path, data, exp_code=[200, 404]) +883 return res.status_code == 200Inherited Members
881def get_mapping_deny_rule(gw_session: GatewaySession, mapping_id: str, -882 denyrule_shortname: str) -> dict: -883 ''' -884 Returns a dictionary object describing the deny rule in the specified -885 Mapping, or None if the mapping or shortname specified were not found. -886 ''' -887 path = f'/configuration/mappings/{mapping_id}/deny-rules/{denyrule_shortname}' -888 res = get(gw_session, path, exp_code=[200, 404]) -889 return res.json().get("data") +@@ -3377,22 +3384,22 @@886def get_mapping_deny_rule(gw_session: GatewaySession, mapping_id: str, +887 denyrule_shortname: str) -> dict: +888 ''' +889 Returns a dictionary object describing the deny rule in the specified +890 Mapping, or None if the mapping or shortname specified were not found. +891 ''' +892 path = f'/configuration/mappings/{mapping_id}/deny-rules/{denyrule_shortname}' +893 res = get(gw_session, path, exp_code=[200, 404]) +894 return res.json().get("data")Inherited Members
892def update_mapping_deny_rule(gw_session: GatewaySession, mapping_id: str, -893 denyrule_shortname: str, attributes: dict) -> bool: -894 ''' -895 Updates the settings for a deny rule within a specified mapping. Returns -896 True if successful, and False if if the mapping or shortname specified -897 were not found. -898 ''' -899 path = f'/configuration/mappings/{mapping_id}/deny-rules/{denyrule_shortname}' -900 data = { -901 "data": { -902 "type": "mapping-deny-rule", -903 "attributes": attributes -904 } -905 } -906 res = patch(gw_session, path, data, exp_code=[200, 404]) -907 return res.status_code == 200 +@@ -3414,14 +3421,14 @@897def update_mapping_deny_rule(gw_session: GatewaySession, mapping_id: str, +898 denyrule_shortname: str, attributes: dict) -> bool: +899 ''' +900 Updates the settings for a deny rule within a specified mapping. Returns +901 True if successful, and False if if the mapping or shortname specified +902 were not found. +903 ''' +904 path = f'/configuration/mappings/{mapping_id}/deny-rules/{denyrule_shortname}' +905 data = { +906 "data": { +907 "type": "mapping-deny-rule", +908 "attributes": attributes +909 } +910 } +911 res = patch(gw_session, path, data, exp_code=[200, 404]) +912 return res.status_code == 200Inherited Members
910def get_deny_rule_groups(gw_session: GatewaySession) -> dict: -911 ''' -912 Returns a list of all deny rule groups on the Airlock Host. -913 ''' -914 -915 path = '/configuration/deny-rule-groups' -916 res = get(gw_session, path, exp_code=200) -917 return res.json().get("data") +@@ -3441,15 +3448,15 @@915def get_deny_rule_groups(gw_session: GatewaySession) -> dict: +916 ''' +917 Returns a list of all deny rule groups on the Airlock Host. +918 ''' +919 +920 path = '/configuration/deny-rule-groups' +921 res = get(gw_session, path, exp_code=200) +922 return res.json().get("data")Inherited Members
920def get_deny_rule_group(gw_session: GatewaySession, short_name: str) -> dict: -921 ''' -922 Returns a dictionary object describing the specified deny rule group, -923 or None if it does not exist. -924 ''' -925 -926 path = f'/configuration/deny-rule-groups/{short_name}' -927 res = get(gw_session, path, exp_code=[200, 404]) -928 return res.json().get("data") +@@ -3470,14 +3477,14 @@925def get_deny_rule_group(gw_session: GatewaySession, short_name: str) -> dict: +926 ''' +927 Returns a dictionary object describing the specified deny rule group, +928 or None if it does not exist. +929 ''' +930 +931 path = f'/configuration/deny-rule-groups/{short_name}' +932 res = get(gw_session, path, exp_code=[200, 404]) +933 return res.json().get("data")Inherited Members
931def get_deny_rules(gw_session: GatewaySession) -> list: -932 ''' -933 Returns a list of all deny-rules on the Airlock Host. -934 ''' -935 -936 path = '/configuration/deny-rules' -937 res = get(gw_session, path, exp_code=200) -938 return res.json().get("data") +@@ -3497,14 +3504,14 @@936def get_deny_rules(gw_session: GatewaySession) -> list: +937 ''' +938 Returns a list of all deny-rules on the Airlock Host. +939 ''' +940 +941 path = '/configuration/deny-rules' +942 res = get(gw_session, path, exp_code=200) +943 return res.json().get("data")Inherited Members
941def get_deny_rule(gw_session: GatewaySession, short_name: str) -> dict: -942 ''' -943 Returns a dictionary object describing the specified deny-rule, or None -944 if it does not exist. -945 ''' -946 path = f'/configuration/deny-rules/{short_name}' -947 res = get(gw_session, path, exp_code=[200, 404]) -948 return res.json().get("data") +@@ -3525,17 +3532,17 @@946def get_deny_rule(gw_session: GatewaySession, short_name: str) -> dict: +947 ''' +948 Returns a dictionary object describing the specified deny-rule, or None +949 if it does not exist. +950 ''' +951 path = f'/configuration/deny-rules/{short_name}' +952 res = get(gw_session, path, exp_code=[200, 404]) +953 return res.json().get("data")Inherited Members
951def load_config(gw_session: GatewaySession, config_id: int, -952 host_name: str = None) -> bool: -953 ''' -954 Loads the configuration with ID `config_id` on the Airlock Host.\n -955 Returns True if the operation was successful and False if no configuration -956 with ID `config_id` was found. -957 ''' -958 data = {"hostname": host_name or gw_session.host_name} -959 path = f"/configuration/configurations/{config_id}/load" -960 res = post(gw_session, path, data, [204, 404]) -961 return res.status_code == 204 +@@ -3558,13 +3565,13 @@956def load_config(gw_session: GatewaySession, config_id: int, +957 host_name: str = None) -> bool: +958 ''' +959 Loads the configuration with ID `config_id` on the Airlock Host.\n +960 Returns True if the operation was successful and False if no configuration +961 with ID `config_id` was found. +962 ''' +963 data = {"hostname": host_name or gw_session.host_name} +964 path = f"/configuration/configurations/{config_id}/load" +965 res = post(gw_session, path, data, [204, 404]) +966 return res.status_code == 204Inherited Members
964def load_empty_config(gw_session: GatewaySession, host_name: str = None): -965 ''' -966 Loads the empty configuration on the Airlock Host. -967 ''' -968 data = {"hostname": host_name or gw_session.host_name} -969 path = "/configuration/configurations/load-empty-config" -970 post(gw_session, path, data, 204) +@@ -3584,11 +3591,11 @@969def load_empty_config(gw_session: GatewaySession, host_name: str = None): +970 ''' +971 Loads the empty configuration on the Airlock Host. +972 ''' +973 data = {"hostname": host_name or gw_session.host_name} +974 path = "/configuration/configurations/load-empty-config" +975 post(gw_session, path, data, 204)Inherited Members
973def load_active_config(gw_session: GatewaySession): -974 ''' -975 Loads the currently active configuration on the Airlock Host. -976 ''' -977 post(gw_session, '/configuration/configurations/load-active', None, 204) +@@ -3608,16 +3615,16 @@978def load_active_config(gw_session: GatewaySession): +979 ''' +980 Loads the currently active configuration on the Airlock Host. +981 ''' +982 post(gw_session, '/configuration/configurations/load-active', None, 204)Inherited Members
980def load_initial_config(gw_session: GatewaySession): -981 ''' -982 Loads the initial configuration on the Airlock Host. -983 ''' -984 res = get(gw_session, '/configuration/configurations', exp_code=200) -985 data = res.json()['data'] -986 init_cfg_id = [x['id'] for x in data -987 if x['attributes']['configType'] == 'INITIAL'][0] -988 path = f'/configuration/configurations/{init_cfg_id}/load' -989 post(gw_session, path, None, 204) +@@ -3637,16 +3644,16 @@985def load_initial_config(gw_session: GatewaySession): +986 ''' +987 Loads the initial configuration on the Airlock Host. +988 ''' +989 res = get(gw_session, '/configuration/configurations', exp_code=200) +990 data = res.json()['data'] +991 init_cfg_id = [x['id'] for x in data +992 if x['attributes']['configType'] == 'INITIAL'][0] +993 path = f'/configuration/configurations/{init_cfg_id}/load' +994 post(gw_session, path, None, 204)Inherited Members
1007def import_config(gw_session: GatewaySession, cfg_zip: str): -1008 ''' -1009 Imports the configuration zip file located at -1010 `cfg_zip` to the Airlock Host. -1011 ''' -1012 with open(cfg_zip, 'rb') as file: -1013 cfg_host_name = _get_hostname_from_config_zip(cfg_zip) -1014 load_empty_config(gw_session, cfg_host_name) -1015 path = "/configuration/configurations/import/" -1016 req_raw(gw_session, "PUT", path, "application/zip", file, 200) +@@ -3667,14 +3674,14 @@1012def import_config(gw_session: GatewaySession, cfg_zip: str): +1013 ''' +1014 Imports the configuration zip file located at +1015 `cfg_zip` to the Airlock Host. +1016 ''' +1017 with open(cfg_zip, 'rb') as file: +1018 cfg_host_name = _get_hostname_from_config_zip(cfg_zip) +1019 load_empty_config(gw_session, cfg_host_name) +1020 path = "/configuration/configurations/import/" +1021 req_raw(gw_session, "PUT", path, "application/zip", file, 200)Inherited Members
1029def export_current_config_file(gw_session: GatewaySession, cfg_zip: str): -1030 ''' -1031 Exports the currently active configuration to a -1032 zip file located at `cfg_zip`. -1033 ''' -1034 data = _export_current_config_data(gw_session) -1035 with open(cfg_zip, 'wb') as file: -1036 file.write(data) +@@ -3695,13 +3702,13 @@1034def export_current_config_file(gw_session: GatewaySession, cfg_zip: str): +1035 ''' +1036 Exports the currently active configuration to a +1037 zip file located at `cfg_zip`. +1038 ''' +1039 data = _export_current_config_data(gw_session) +1040 with open(cfg_zip, 'wb') as file: +1041 file.write(data)Inherited Members
1039def get_error_page_settings(gw_session: GatewaySession) -> dict: -1040 ''' -1041 Returns a dictionary object describing the current error page settings. -1042 ''' -1043 path = '/configuration/error-pages' -1044 res = get(gw_session, path, exp_code=200) -1045 return res.json().get('data') +@@ -3721,18 +3728,18 @@1044def get_error_page_settings(gw_session: GatewaySession) -> dict: +1045 ''' +1046 Returns a dictionary object describing the current error page settings. +1047 ''' +1048 path = '/configuration/error-pages' +1049 res = get(gw_session, path, exp_code=200) +1050 return res.json().get('data')Inherited Members
1048def set_error_page_settings(gw_session: GatewaySession, attributes: dict): -1049 ''' -1050 Updates the error page settings with the given attributes. -1051 ''' -1052 path = '/configuration/error-pages' -1053 data = { -1054 "data": { -1055 "type": "error-pages", -1056 "attributes": attributes -1057 } -1058 } -1059 patch(gw_session, path, data, exp_code=200) +@@ -3752,15 +3759,15 @@1053def set_error_page_settings(gw_session: GatewaySession, attributes: dict): +1054 ''' +1055 Updates the error page settings with the given attributes. +1056 ''' +1057 path = '/configuration/error-pages' +1058 data = { +1059 "data": { +1060 "type": "error-pages", +1061 "attributes": attributes +1062 } +1063 } +1064 patch(gw_session, path, data, exp_code=200)Inherited Members
1062def get_error_pages(gw_session: GatewaySession) -> Union[bytes, None]: -1063 ''' -1064 Returns a zip file containing the error pages -1065 ''' -1066 path = '/configuration/error-pages/content' -1067 res = get(gw_session, path, exp_code=[200, 404]) -1068 if res.status_code == 404: -1069 return None -1070 return res.content +@@ -3780,13 +3787,13 @@1067def get_error_pages(gw_session: GatewaySession) -> Union[bytes, None]: +1068 ''' +1069 Returns a zip file containing the error pages +1070 ''' +1071 path = '/configuration/error-pages/content' +1072 res = get(gw_session, path, exp_code=[200, 404]) +1073 if res.status_code == 404: +1074 return None +1075 return res.contentInherited Members
1073def set_error_pages(gw_session: GatewaySession, error_page_zip: str): -1074 ''' -1075 Imports the error page zip-file located at `error_page_zip`. -1076 ''' -1077 with open(error_page_zip, 'rb') as file: -1078 path = "/configuration/error-pages/content" -1079 req_raw(gw_session, "PUT", path, "application/zip", file, 200) +@@ -3806,12 +3813,12 @@1078def set_error_pages(gw_session: GatewaySession, error_page_zip: str): +1079 ''' +1080 Imports the error page zip-file located at `error_page_zip`. +1081 ''' +1082 with open(error_page_zip, 'rb') as file: +1083 path = "/configuration/error-pages/content" +1084 req_raw(gw_session, "PUT", path, "application/zip", file, 200)Inherited Members
1082def delete_error_pages(gw_session: GatewaySession): -1083 ''' -1084 Remove the custom error pages. -1085 ''' -1086 path = '/configuration/error-pages/content' -1087 delete(gw_session, path, exp_code=200) +@@ -3831,13 +3838,13 @@1087def delete_error_pages(gw_session: GatewaySession): +1088 ''' +1089 Remove the custom error pages. +1090 ''' +1091 path = '/configuration/error-pages/content' +1092 delete(gw_session, path, exp_code=200)Inherited Members
1090def get_default_error_pages(gw_session: GatewaySession) -> bytes: -1091 ''' -1092 Returns a zip file containing the default error pages. -1093 ''' -1094 path = '/configuration/error-pages/content/default' -1095 res = get(gw_session, path, exp_code=200) -1096 return res.content +@@ -3857,13 +3864,13 @@1095def get_default_error_pages(gw_session: GatewaySession) -> bytes: +1096 ''' +1097 Returns a zip file containing the default error pages. +1098 ''' +1099 path = '/configuration/error-pages/content/default' +1100 res = get(gw_session, path, exp_code=200) +1101 return res.contentInherited Members
1099def get_expert_settings(gw_session: GatewaySession) -> dict: -1100 ''' -1101 Returns a dict containing the global expert settings for the Gateway as well as for Apache -1102 ''' -1103 path = '/configuration/expert-settings' -1104 res = get(gw_session, path, exp_code=200) -1105 return res.json().get('data') +@@ -3883,18 +3890,18 @@1104def get_expert_settings(gw_session: GatewaySession) -> dict: +1105 ''' +1106 Returns a dict containing the global expert settings for the Gateway as well as for Apache +1107 ''' +1108 path = '/configuration/expert-settings' +1109 res = get(gw_session, path, exp_code=200) +1110 return res.json().get('data')Inherited Members
1108def set_expert_settings(gw_session: GatewaySession, attributes: dict) -> None: -1109 ''' -1110 Updates the global expert settings with the given attributes. -1111 ''' -1112 path = '/configuration/expert-settings' -1113 data = { -1114 "data": { -1115 "type": 'expert-settings', -1116 "attributes": attributes -1117 } -1118 } -1119 patch(gw_session, path, data, exp_code=200) +1113def set_expert_settings(gw_session: GatewaySession, attributes: dict) -> None: +1114 ''' +1115 Updates the global expert settings with the given attributes. +1116 ''' +1117 path = '/configuration/expert-settings' +1118 data = { +1119 "data": { +1120 "type": 'expert-settings', +1121 "attributes": attributes +1122 } +1123 } +1124 patch(gw_session, path, data, exp_code=200)