Code Duplication    Length = 35-40 lines in 4 locations

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

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

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

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

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

@@ 1874-1913 (lines=40) @@
1871
1872
        return self._send_xml_command(cmd)
1873
1874
    def get_report_formats(
1875
        self,
1876
        *,
1877
        filter: Optional[str] = None,
1878
        filter_id: Optional[str] = None,
1879
        trash: Optional[bool] = None,
1880
        alerts: Optional[bool] = None,
1881
        params: Optional[bool] = None,
1882
        details: Optional[bool] = None,
1883
    ) -> Any:
1884
        """Request a list of report formats
1885
1886
        Arguments:
1887
            filter: Filter term to use for the query
1888
            filter_id: UUID of an existing filter to use for the query
1889
            trash: Whether to get the trashcan report formats instead
1890
            alerts: Whether to include alerts that use the report format
1891
            params: Whether to include report format parameters
1892
            details: Include report format file, signature and parameters
1893
1894
        Returns:
1895
            The response. See :py:meth:`send_command` for details.
1896
        """
1897
        cmd = XmlCommand("get_report_formats")
1898
1899
        add_filter(cmd, filter, filter_id)
1900
1901
        if details is not None:
1902
            cmd.set_attribute("details", to_bool(details))
1903
1904
        if alerts is not None:
1905
            cmd.set_attribute("alerts", to_bool(alerts))
1906
1907
        if params is not None:
1908
            cmd.set_attribute("params", to_bool(params))
1909
1910
        if trash is not None:
1911
            cmd.set_attribute("trash", to_bool(trash))
1912
1913
        return self._send_xml_command(cmd)
1914
1915
    def get_report_format(
1916
        self, report_format_id: Union[str, ReportFormatType]