@@ 3293-3317 (lines=25) @@ | ||
3290 | cmd.add_element("copy", config_id) |
|
3291 | return self._send_xml_command(cmd) |
|
3292 | ||
3293 | def import_config(self, config: str) -> Any: |
|
3294 | """Import a scan config from XML |
|
3295 | ||
3296 | Arguments: |
|
3297 | config: Scan Config XML as string to import. This XML must |
|
3298 | contain a :code:`<get_configs_response>` root element. |
|
3299 | ||
3300 | Returns: |
|
3301 | The response. See :py:meth:`send_command` for details. |
|
3302 | """ |
|
3303 | if not config: |
|
3304 | raise RequiredArgument( |
|
3305 | function=self.import_config.__name__, argument='config' |
|
3306 | ) |
|
3307 | ||
3308 | cmd = XmlCommand("create_config") |
|
3309 | ||
3310 | try: |
|
3311 | cmd.append_xml_str(config) |
|
3312 | except etree.XMLSyntaxError as e: |
|
3313 | raise InvalidArgument( |
|
3314 | function=self.import_config.__name__, argument='config' |
|
3315 | ) from e |
|
3316 | ||
3317 | return self._send_xml_command(cmd) |
|
3318 | ||
3319 | def clone_credential(self, credential_id: str) -> Any: |
|
3320 | """Clone an existing credential |
@@ 513-537 (lines=25) @@ | ||
510 | cmd.add_element("copy", config_id) |
|
511 | return self._send_xml_command(cmd) |
|
512 | ||
513 | def import_config(self, config: str) -> Any: |
|
514 | """Import a scan config from XML |
|
515 | ||
516 | Arguments: |
|
517 | config: Scan Config XML as string to import. This XML must |
|
518 | contain a :code:`<get_configs_response>` root element. |
|
519 | ||
520 | Returns: |
|
521 | The response. See :py:meth:`send_command` for details. |
|
522 | """ |
|
523 | if not config: |
|
524 | raise RequiredArgument( |
|
525 | function=self.import_config.__name__, argument='config' |
|
526 | ) |
|
527 | ||
528 | cmd = XmlCommand("create_config") |
|
529 | ||
530 | try: |
|
531 | cmd.append_xml_str(config) |
|
532 | except etree.XMLSyntaxError as e: |
|
533 | raise InvalidArgument( |
|
534 | function=self.import_config.__name__, argument='config' |
|
535 | ) from e |
|
536 | ||
537 | return self._send_xml_command(cmd) |
|
538 | ||
539 | def create_credential( |
|
540 | self, |