@@ 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, |
@@ 3325-3349 (lines=25) @@ | ||
3322 | cmd.add_element("copy", config_id) |
|
3323 | return self._send_xml_command(cmd) |
|
3324 | ||
3325 | def import_config(self, config: str) -> Any: |
|
3326 | """Import a scan config from XML |
|
3327 | ||
3328 | Arguments: |
|
3329 | config: Scan Config XML as string to import. This XML must |
|
3330 | contain a :code:`<get_configs_response>` root element. |
|
3331 | ||
3332 | Returns: |
|
3333 | The response. See :py:meth:`send_command` for details. |
|
3334 | """ |
|
3335 | if not config: |
|
3336 | raise RequiredArgument( |
|
3337 | function=self.import_config.__name__, argument='config' |
|
3338 | ) |
|
3339 | ||
3340 | cmd = XmlCommand("create_config") |
|
3341 | ||
3342 | try: |
|
3343 | cmd.append_xml_str(config) |
|
3344 | except etree.XMLSyntaxError as e: |
|
3345 | raise InvalidArgument( |
|
3346 | function=self.import_config.__name__, argument='config' |
|
3347 | ) from e |
|
3348 | ||
3349 | return self._send_xml_command(cmd) |
|
3350 | ||
3351 | def clone_credential(self, credential_id: str) -> Any: |
|
3352 | """Clone an existing credential |