Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 4 locations

@@ 852-884 (lines=33) @@
849
850
        return self._send_xml_command(cmd)
851
852
    def get_tls_certificates(
853
        self,
854
        *,
855
        filter: Optional[str] = None,
856
        filter_id: Optional[str] = None,
857
        include_certificate_data: Optional[bool] = None,
858
        details: Optional[bool] = None,
859
    ) -> Any:
860
        """Request a list of TLS certificates
861
862
        Arguments:
863
            filter: Filter term to use for the query
864
            filter_id: UUID of an existing filter to use for the query
865
            include_certificate_data: Whether to include the certificate data in
866
                the response
867
868
        Returns:
869
            The response. See :py:meth:`send_command` for details.
870
        """
871
872
        cmd = XmlCommand("get_tls_certificates")
873
874
        add_filter(cmd, filter, filter_id)
875
876
        if details is not None:
877
            cmd.set_attribute("details", to_bool(details))
878
879
        if include_certificate_data is not None:
880
            cmd.set_attribute(
881
                "include_certificate_data", to_bool(include_certificate_data)
882
            )
883
884
        return self._send_xml_command(cmd)
885
886
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
887
        """Request a single TLS certificate
@@ 4808-4838 (lines=31) @@
4805
        cmd.set_attribute("role_id", role_id)
4806
        return self._send_xml_command(cmd)
4807
4808
    def get_scanners(
4809
        self,
4810
        *,
4811
        filter: Optional[str] = None,
4812
        filter_id: Optional[str] = None,
4813
        trash: Optional[bool] = None,
4814
        details: Optional[bool] = None,
4815
    ) -> Any:
4816
        """Request a list of scanners
4817
4818
        Arguments:
4819
            filter: Filter term to use for the query
4820
            filter_id: UUID of an existing filter to use for the query
4821
            trash: Whether to get the trashcan scanners instead
4822
            details:  Whether to include extra details like tasks using this
4823
                scanner
4824
4825
        Returns:
4826
            The response. See :py:meth:`send_command` for details.
4827
        """
4828
        cmd = XmlCommand("get_scanners")
4829
4830
        add_filter(cmd, filter, filter_id)
4831
4832
        if trash is not None:
4833
            cmd.set_attribute("trash", to_bool(trash))
4834
4835
        if details is not None:
4836
            cmd.set_attribute("details", to_bool(details))
4837
4838
        return self._send_xml_command(cmd)
4839
4840
    def get_scanner(self, scanner_id: str) -> Any:
4841
        """Request a single scanner
@@ 4472-4501 (lines=30) @@
4469
4470
        return self._send_xml_command(cmd)
4471
4472
    def get_overrides(
4473
        self,
4474
        *,
4475
        filter: Optional[str] = None,
4476
        filter_id: Optional[str] = None,
4477
        details: Optional[bool] = None,
4478
        result: Optional[bool] = None,
4479
    ) -> Any:
4480
        """Request a list of overrides
4481
4482
        Arguments:
4483
            filter: Filter term to use for the query
4484
            filter_id: UUID of an existing filter to use for the query
4485
            details: Whether to include full details
4486
            result: Whether to include results using the override
4487
4488
        Returns:
4489
            The response. See :py:meth:`send_command` for details.
4490
        """
4491
        cmd = XmlCommand("get_overrides")
4492
4493
        add_filter(cmd, filter, filter_id)
4494
4495
        if details is not None:
4496
            cmd.set_attribute("details", to_bool(details))
4497
4498
        if result is not None:
4499
            cmd.set_attribute("result", to_bool(result))
4500
4501
        return self._send_xml_command(cmd)
4502
4503
    def get_override(self, override_id: str) -> Any:
4504
        """Request a single override
@@ 4319-4348 (lines=30) @@
4316
        cmd.set_attribute("group_id", group_id)
4317
        return self._send_xml_command(cmd)
4318
4319
    def get_notes(
4320
        self,
4321
        *,
4322
        filter: Optional[str] = None,
4323
        filter_id: Optional[str] = None,
4324
        details: Optional[bool] = None,
4325
        result: Optional[bool] = None,
4326
    ) -> Any:
4327
        """Request a list of notes
4328
4329
        Arguments:
4330
            filter: Filter term to use for the query
4331
            filter_id: UUID of an existing filter to use for the query
4332
            details: Add info about connected results and tasks
4333
            result: Return the details of possible connected results.
4334
4335
        Returns:
4336
            The response. See :py:meth:`send_command` for details.
4337
        """
4338
        cmd = XmlCommand("get_notes")
4339
4340
        add_filter(cmd, filter, filter_id)
4341
4342
        if details is not None:
4343
            cmd.set_attribute("details", to_bool(details))
4344
4345
        if result is not None:
4346
            cmd.set_attribute("result", to_bool(result))
4347
4348
        return self._send_xml_command(cmd)
4349
4350
    def get_note(self, note_id: str) -> Any:
4351
        """Request a single note