Code Duplication    Length = 35-40 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 2959-2998 (lines=40) @@
2956
2957
        return self._send_xml_command(cmd)
2958
2959
    def get_report_formats(
2960
        self,
2961
        *,
2962
        filter: Optional[str] = None,
2963
        filter_id: Optional[str] = None,
2964
        trash: Optional[bool] = None,
2965
        alerts: Optional[bool] = None,
2966
        params: Optional[bool] = None,
2967
        details: Optional[bool] = None,
2968
    ) -> Any:
2969
        """Request a list of report formats
2970
2971
        Arguments:
2972
            filter: Filter term to use for the query
2973
            filter_id: UUID of an existing filter to use for the query
2974
            trash: Whether to get the trashcan report formats instead
2975
            alerts: Whether to include alerts that use the report format
2976
            params: Whether to include report format parameters
2977
            details: Include report format file, signature and parameters
2978
2979
        Returns:
2980
            The response. See :py:meth:`send_command` for details.
2981
        """
2982
        cmd = XmlCommand("get_report_formats")
2983
2984
        add_filter(cmd, filter, filter_id)
2985
2986
        if details is not None:
2987
            cmd.set_attribute("details", to_bool(details))
2988
2989
        if alerts is not None:
2990
            cmd.set_attribute("alerts", to_bool(alerts))
2991
2992
        if params is not None:
2993
            cmd.set_attribute("params", to_bool(params))
2994
2995
        if trash is not None:
2996
            cmd.set_attribute("trash", to_bool(trash))
2997
2998
        return self._send_xml_command(cmd)
2999
3000
    def get_report_format(
3001
        self, report_format_id: Union[str, ReportFormatType]

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