Code Duplication    Length = 35-40 lines in 4 locations

gvm/protocols/gmpv208/entities/port_lists.py 1 location

@@ 207-241 (lines=35) @@
204
205
        return self._send_xml_command(cmd)
206
207
    def get_port_lists(
208
        self,
209
        *,
210
        filter: Optional[str] = None,
211
        filter_id: Optional[str] = None,
212
        details: Optional[bool] = None,
213
        targets: Optional[bool] = None,
214
        trash: Optional[bool] = None,
215
    ) -> Any:
216
        """Request a list of port lists
217
218
        Arguments:
219
            filter: Filter term to use for the query
220
            filter_id: UUID of an existing filter to use for the query
221
            details: Whether to include full port list details
222
            targets: Whether to include targets using this port list
223
            trash: Whether to get port lists in the trashcan instead
224
225
        Returns:
226
            The response. See :py:meth:`send_command` for details.
227
        """
228
        cmd = XmlCommand("get_port_lists")
229
230
        add_filter(cmd, filter, filter_id)
231
232
        if details is not None:
233
            cmd.set_attribute("details", to_bool(details))
234
235
        if targets is not None:
236
            cmd.set_attribute("targets", to_bool(targets))
237
238
        if trash is not None:
239
            cmd.set_attribute("trash", to_bool(trash))
240
241
        return self._send_xml_command(cmd)
242
243
    def get_port_list(self, port_list_id: str):
244
        """Request a single port list

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 732-771 (lines=40) @@
729
730
        return self._send_xml_command(cmd)
731
732
    def get_report_formats(
733
        self,
734
        *,
735
        filter: Optional[str] = None,
736
        filter_id: Optional[str] = None,
737
        trash: Optional[bool] = None,
738
        alerts: Optional[bool] = None,
739
        params: Optional[bool] = None,
740
        details: Optional[bool] = None,
741
    ) -> Any:
742
        """Request a list of report formats
743
744
        Arguments:
745
            filter: Filter term to use for the query
746
            filter_id: UUID of an existing filter to use for the query
747
            trash: Whether to get the trashcan report formats instead
748
            alerts: Whether to include alerts that use the report format
749
            params: Whether to include report format parameters
750
            details: Include report format file, signature and parameters
751
752
        Returns:
753
            The response. See :py:meth:`send_command` for details.
754
        """
755
        cmd = XmlCommand("get_report_formats")
756
757
        add_filter(cmd, filter, filter_id)
758
759
        if details is not None:
760
            cmd.set_attribute("details", to_bool(details))
761
762
        if alerts is not None:
763
            cmd.set_attribute("alerts", to_bool(alerts))
764
765
        if params is not None:
766
            cmd.set_attribute("params", to_bool(params))
767
768
        if trash is not None:
769
            cmd.set_attribute("trash", to_bool(trash))
770
771
        return self._send_xml_command(cmd)
772
773
    def get_report_format(
774
        self, report_format_id: Union[str, ReportFormatType]

gvm/protocols/gmpv208/entities/tasks.py 1 location

@@ 212-248 (lines=37) @@
209
210
        return self._send_xml_command(cmd)
211
212
    def get_tasks(
213
        self,
214
        *,
215
        filter: Optional[str] = None,
216
        filter_id: Optional[str] = None,
217
        trash: Optional[bool] = None,
218
        details: Optional[bool] = None,
219
        schedules_only: Optional[bool] = None,
220
    ) -> Any:
221
        """Request a list of tasks
222
223
        Arguments:
224
            filter: Filter term to use for the query
225
            filter_id: UUID of an existing filter to use for the query
226
            trash: Whether to get the trashcan tasks instead
227
            details: Whether to include full task details
228
            schedules_only: Whether to only include id, name and schedule
229
                details
230
231
        Returns:
232
            The response. See :py:meth:`send_command` for details.
233
        """
234
        cmd = XmlCommand("get_tasks")
235
        cmd.set_attribute("usage_type", "scan")
236
237
        add_filter(cmd, filter, filter_id)
238
239
        if trash is not None:
240
            cmd.set_attribute("trash", to_bool(trash))
241
242
        if details is not None:
243
            cmd.set_attribute("details", to_bool(details))
244
245
        if schedules_only is not None:
246
            cmd.set_attribute("schedules_only", to_bool(schedules_only))
247
248
        return self._send_xml_command(cmd)
249
250
    def get_task(self, task_id: str) -> Any:
251
        """Request a single task

gvm/protocols/gmpv208/entities/audits.py 1 location

@@ 204-240 (lines=37) @@
201
202
        return self._send_xml_command(cmd)
203
204
    def get_audits(
205
        self,
206
        *,
207
        filter: Optional[str] = None,
208
        filter_id: Optional[str] = None,
209
        trash: Optional[bool] = None,
210
        details: Optional[bool] = None,
211
        schedules_only: Optional[bool] = None,
212
    ) -> Any:
213
        """Request a list of audits
214
215
        Arguments:
216
            filter: Filter term to use for the query
217
            filter_id: UUID of an existing filter to use for the query
218
            trash: Whether to get the trashcan audits instead
219
            details: Whether to include full audit details
220
            schedules_only: Whether to only include id, name and schedule
221
                details
222
223
        Returns:
224
            The response. See :py:meth:`send_command` for details.
225
        """
226
        cmd = XmlCommand("get_tasks")
227
        cmd.set_attribute("usage_type", "audit")
228
229
        add_filter(cmd, filter, filter_id)
230
231
        if trash is not None:
232
            cmd.set_attribute("trash", to_bool(trash))
233
234
        if details is not None:
235
            cmd.set_attribute("details", to_bool(details))
236
237
        if schedules_only is not None:
238
            cmd.set_attribute("schedules_only", to_bool(schedules_only))
239
240
        return self._send_xml_command(cmd)
241
242
    def get_audit(self, audit_id: str) -> Any:
243
        """Request a single audit