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

@@ 3934-3964 (lines=31) @@
3931
        cmd.set_attribute("role_id", role_id)
3932
        return self._send_xml_command(cmd)
3933
3934
    def get_scanners(
3935
        self,
3936
        *,
3937
        filter: Optional[str] = None,
3938
        filter_id: Optional[str] = None,
3939
        trash: Optional[bool] = None,
3940
        details: Optional[bool] = None
3941
    ) -> Any:
3942
        """Request a list of scanners
3943
3944
        Arguments:
3945
            filter: Filter term to use for the query
3946
            filter_id: UUID of an existing filter to use for the query
3947
            trash: Whether to get the trashcan scanners instead
3948
            details:  Whether to include extra details like tasks using this
3949
                scanner
3950
3951
        Returns:
3952
            The response. See :py:meth:`send_command` for details.
3953
        """
3954
        cmd = XmlCommand("get_scanners")
3955
3956
        _add_filter(cmd, filter, filter_id)
3957
3958
        if trash is not None:
3959
            cmd.set_attribute("trash", _to_bool(trash))
3960
3961
        if details is not None:
3962
            cmd.set_attribute("details", _to_bool(details))
3963
3964
        return self._send_xml_command(cmd)
3965
3966
    def get_scanner(self, scanner_id: str) -> Any:
3967
        """Request a single scanner
@@ 3451-3480 (lines=30) @@
3448
3449
        return self._send_xml_command(cmd)
3450
3451
    def get_overrides(
3452
        self,
3453
        *,
3454
        filter: Optional[str] = None,
3455
        filter_id: Optional[str] = None,
3456
        details: Optional[bool] = None,
3457
        result: Optional[bool] = None
3458
    ) -> Any:
3459
        """Request a list of overrides
3460
3461
        Arguments:
3462
            filter: Filter term to use for the query
3463
            filter_id: UUID of an existing filter to use for the query
3464
            details: Whether to include full details
3465
            result: Whether to include results using the override
3466
3467
        Returns:
3468
            The response. See :py:meth:`send_command` for details.
3469
        """
3470
        cmd = XmlCommand("get_overrides")
3471
3472
        _add_filter(cmd, filter, filter_id)
3473
3474
        if details is not None:
3475
            cmd.set_attribute("details", _to_bool(details))
3476
3477
        if result is not None:
3478
            cmd.set_attribute("result", _to_bool(result))
3479
3480
        return self._send_xml_command(cmd)
3481
3482
    def get_override(self, override_id: str) -> Any:
3483
        """Request a single override
@@ 3300-3329 (lines=30) @@
3297
3298
        return self._send_xml_command(cmd)
3299
3300
    def get_notes(
3301
        self,
3302
        *,
3303
        filter: Optional[str] = None,
3304
        filter_id: Optional[str] = None,
3305
        details: Optional[bool] = None,
3306
        result: Optional[bool] = None
3307
    ) -> Any:
3308
        """Request a list of notes
3309
3310
        Arguments:
3311
            filter: Filter term to use for the query
3312
            filter_id: UUID of an existing filter to use for the query
3313
            details: Add info about connected results and tasks
3314
            result: Return the details of possible connected results.
3315
3316
        Returns:
3317
            The response. See :py:meth:`send_command` for details.
3318
        """
3319
        cmd = XmlCommand("get_notes")
3320
3321
        _add_filter(cmd, filter, filter_id)
3322
3323
        if details is not None:
3324
            cmd.set_attribute("details", _to_bool(details))
3325
3326
        if result is not None:
3327
            cmd.set_attribute("result", _to_bool(result))
3328
3329
        return self._send_xml_command(cmd)
3330
3331
    def get_note(self, note_id: str) -> Any:
3332
        """Request a single note