Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv9/gmpv9.py 1 location

@@ 491-523 (lines=33) @@
488
489
        return self._send_xml_command(cmd)
490
491
    def get_tls_certificates(
492
        self,
493
        *,
494
        filter: Optional[str] = None,
495
        filter_id: Optional[str] = None,
496
        include_certificate_data: Optional[bool] = None,
497
        details: Optional[bool] = None
498
    ) -> Any:
499
        """Request a list of TLS certificates
500
501
        Arguments:
502
            filter: Filter term to use for the query
503
            filter_id: UUID of an existing filter to use for the query
504
            include_certificate_data: Whether to include the certificate data in
505
                the response
506
507
        Returns:
508
            The response. See :py:meth:`send_command` for details.
509
        """
510
511
        cmd = XmlCommand("get_tls_certificates")
512
513
        _add_filter(cmd, filter, filter_id)
514
515
        if details is not None:
516
            cmd.set_attribute("details", _to_bool(details))
517
518
        if include_certificate_data is not None:
519
            cmd.set_attribute(
520
                "include_certificate_data", _to_bool(include_certificate_data)
521
            )
522
523
        return self._send_xml_command(cmd)
524
525
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
526
        """Request a single TLS certificate

gvm/protocols/gmpv7/gmpv7.py 3 locations

@@ 3316-3345 (lines=30) @@
3313
3314
        return self._send_xml_command(cmd)
3315
3316
    def get_notes(
3317
        self,
3318
        *,
3319
        filter: Optional[str] = None,
3320
        filter_id: Optional[str] = None,
3321
        details: Optional[bool] = None,
3322
        result: Optional[bool] = None
3323
    ) -> Any:
3324
        """Request a list of notes
3325
3326
        Arguments:
3327
            filter: Filter term to use for the query
3328
            filter_id: UUID of an existing filter to use for the query
3329
            details: Add info about connected results and tasks
3330
            result: Return the details of possible connected results.
3331
3332
        Returns:
3333
            The response. See :py:meth:`send_command` for details.
3334
        """
3335
        cmd = XmlCommand("get_notes")
3336
3337
        _add_filter(cmd, filter, filter_id)
3338
3339
        if details is not None:
3340
            cmd.set_attribute("details", _to_bool(details))
3341
3342
        if result is not None:
3343
            cmd.set_attribute("result", _to_bool(result))
3344
3345
        return self._send_xml_command(cmd)
3346
3347
    def get_note(self, note_id: str) -> Any:
3348
        """Request a single note
@@ 3964-3994 (lines=31) @@
3961
        cmd.set_attribute("role_id", role_id)
3962
        return self._send_xml_command(cmd)
3963
3964
    def get_scanners(
3965
        self,
3966
        *,
3967
        filter: Optional[str] = None,
3968
        filter_id: Optional[str] = None,
3969
        trash: Optional[bool] = None,
3970
        details: Optional[bool] = None
3971
    ) -> Any:
3972
        """Request a list of scanners
3973
3974
        Arguments:
3975
            filter: Filter term to use for the query
3976
            filter_id: UUID of an existing filter to use for the query
3977
            trash: Whether to get the trashcan scanners instead
3978
            details:  Whether to include extra details like tasks using this
3979
                scanner
3980
3981
        Returns:
3982
            The response. See :py:meth:`send_command` for details.
3983
        """
3984
        cmd = XmlCommand("get_scanners")
3985
3986
        _add_filter(cmd, filter, filter_id)
3987
3988
        if trash is not None:
3989
            cmd.set_attribute("trash", _to_bool(trash))
3990
3991
        if details is not None:
3992
            cmd.set_attribute("details", _to_bool(details))
3993
3994
        return self._send_xml_command(cmd)
3995
3996
    def get_scanner(self, scanner_id: str) -> Any:
3997
        """Request a single scanner
@@ 3470-3499 (lines=30) @@
3467
3468
        return self._send_xml_command(cmd)
3469
3470
    def get_overrides(
3471
        self,
3472
        *,
3473
        filter: Optional[str] = None,
3474
        filter_id: Optional[str] = None,
3475
        details: Optional[bool] = None,
3476
        result: Optional[bool] = None
3477
    ) -> Any:
3478
        """Request a list of overrides
3479
3480
        Arguments:
3481
            filter: Filter term to use for the query
3482
            filter_id: UUID of an existing filter to use for the query
3483
            details: Whether to include full details
3484
            result: Whether to include results using the override
3485
3486
        Returns:
3487
            The response. See :py:meth:`send_command` for details.
3488
        """
3489
        cmd = XmlCommand("get_overrides")
3490
3491
        _add_filter(cmd, filter, filter_id)
3492
3493
        if details is not None:
3494
            cmd.set_attribute("details", _to_bool(details))
3495
3496
        if result is not None:
3497
            cmd.set_attribute("result", _to_bool(result))
3498
3499
        return self._send_xml_command(cmd)
3500
3501
    def get_override(self, override_id: str) -> Any:
3502
        """Request a single override