Code Duplication    Length = 29-31 lines in 6 locations

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

@@ 199-229 (lines=31) @@
196
197
        return self._send_xml_command(cmd)
198
199
    def get_scanners(
200
        self,
201
        *,
202
        filter: Optional[str] = None,
203
        filter_id: Optional[str] = None,
204
        trash: Optional[bool] = None,
205
        details: Optional[bool] = None,
206
    ) -> Any:
207
        """Request a list of scanners
208
209
        Arguments:
210
            filter: Filter term to use for the query
211
            filter_id: UUID of an existing filter to use for the query
212
            trash: Whether to get the trashcan scanners instead
213
            details:  Whether to include extra details like tasks using this
214
                scanner
215
216
        Returns:
217
            The response. See :py:meth:`send_command` for details.
218
        """
219
        cmd = XmlCommand("get_scanners")
220
221
        add_filter(cmd, filter, filter_id)
222
223
        if trash is not None:
224
            cmd.set_attribute("trash", to_bool(trash))
225
226
        if details is not None:
227
            cmd.set_attribute("details", to_bool(details))
228
229
        return self._send_xml_command(cmd)
230
231
    def get_scanner(self, scanner_id: str) -> Any:
232
        """Request a single scanner

gvm/protocols/gmpv208/gmpv208.py 3 locations

@@ 2131-2160 (lines=30) @@
2128
2129
        return self._send_xml_command(cmd)
2130
2131
    def get_tags(
2132
        self,
2133
        *,
2134
        filter: Optional[str] = None,
2135
        filter_id: Optional[str] = None,
2136
        trash: Optional[bool] = None,
2137
        names_only: Optional[bool] = None,
2138
    ) -> Any:
2139
        """Request a list of tags
2140
2141
        Arguments:
2142
            filter: Filter term to use for the query
2143
            filter_id: UUID of an existing filter to use for the query
2144
            trash: Whether to get tags from the trashcan instead
2145
            names_only: Whether to get only distinct tag names
2146
2147
        Returns:
2148
            The response. See :py:meth:`send_command` for details.
2149
        """
2150
        cmd = XmlCommand("get_tags")
2151
2152
        add_filter(cmd, filter, filter_id)
2153
2154
        if trash is not None:
2155
            cmd.set_attribute("trash", to_bool(trash))
2156
2157
        if names_only is not None:
2158
            cmd.set_attribute("names_only", to_bool(names_only))
2159
2160
        return self._send_xml_command(cmd)
2161
2162
    def get_tag(self, tag_id: str) -> Any:
2163
        """Request a single tag
@@ 1988-2017 (lines=30) @@
1985
        cmd.set_attribute("role_id", role_id)
1986
        return self._send_xml_command(cmd)
1987
1988
    def get_schedules(
1989
        self,
1990
        *,
1991
        filter: Optional[str] = None,
1992
        filter_id: Optional[str] = None,
1993
        trash: Optional[bool] = None,
1994
        tasks: Optional[bool] = None,
1995
    ) -> Any:
1996
        """Request a list of schedules
1997
1998
        Arguments:
1999
            filter: Filter term to use for the query
2000
            filter_id: UUID of an existing filter to use for the query
2001
            trash: Whether to get the trashcan schedules instead
2002
            tasks: Whether to include tasks using the schedules
2003
2004
        Returns:
2005
            The response. See :py:meth:`send_command` for details.
2006
        """
2007
        cmd = XmlCommand("get_schedules")
2008
2009
        add_filter(cmd, filter, filter_id)
2010
2011
        if trash is not None:
2012
            cmd.set_attribute("trash", to_bool(trash))
2013
2014
        if tasks is not None:
2015
            cmd.set_attribute("tasks", to_bool(tasks))
2016
2017
        return self._send_xml_command(cmd)
2018
2019
    def get_schedule(
2020
        self, schedule_id: str, *, tasks: Optional[bool] = None
@@ 1666-1695 (lines=30) @@
1663
        """
1664
        return self._send_xml_command(XmlCommand("get_feeds"))
1665
1666
    def get_filters(
1667
        self,
1668
        *,
1669
        filter: Optional[str] = None,
1670
        filter_id: Optional[str] = None,
1671
        trash: Optional[bool] = None,
1672
        alerts: Optional[bool] = None,
1673
    ) -> Any:
1674
        """Request a list of filters
1675
1676
        Arguments:
1677
            filter: Filter term to use for the query
1678
            filter_id: UUID of an existing filter to use for the query
1679
            trash: Whether to get the trashcan filters instead
1680
            alerts: Whether to include list of alerts that use the filter.
1681
1682
        Returns:
1683
            The response. See :py:meth:`send_command` for details.
1684
        """
1685
        cmd = XmlCommand("get_filters")
1686
1687
        add_filter(cmd, filter, filter_id)
1688
1689
        if trash is not None:
1690
            cmd.set_attribute("trash", to_bool(trash))
1691
1692
        if alerts is not None:
1693
            cmd.set_attribute("alerts", to_bool(alerts))
1694
1695
        return self._send_xml_command(cmd)
1696
1697
    def get_filter(
1698
        self, filter_id: str, *, alerts: Optional[bool] = None

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

@@ 254-283 (lines=30) @@
251
252
        return self._send_xml_command(cmd)
253
254
    def get_targets(
255
        self,
256
        *,
257
        filter: Optional[str] = None,
258
        filter_id: Optional[str] = None,
259
        trash: Optional[bool] = None,
260
        tasks: Optional[bool] = None,
261
    ) -> Any:
262
        """Request a list of targets
263
264
        Arguments:
265
            filter: Filter term to use for the query
266
            filter_id: UUID of an existing filter to use for the query
267
            trash: Whether to get the trashcan targets instead
268
            tasks: Whether to include list of tasks that use the target
269
270
        Returns:
271
            The response. See :py:meth:`send_command` for details.
272
        """
273
        cmd = XmlCommand("get_targets")
274
275
        add_filter(cmd, filter, filter_id)
276
277
        if trash is not None:
278
            cmd.set_attribute("trash", to_bool(trash))
279
280
        if tasks is not None:
281
            cmd.set_attribute("tasks", to_bool(tasks))
282
283
        return self._send_xml_command(cmd)
284
285
    def modify_target(
286
        self,

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

@@ 360-388 (lines=29) @@
357
358
        return self._send_xml_command(cmd)
359
360
    def get_alerts(
361
        self,
362
        *,
363
        filter: Optional[str] = None,
364
        filter_id: Optional[str] = None,
365
        trash: Optional[bool] = None,
366
        tasks: Optional[bool] = None,
367
    ) -> Any:
368
        """Request a list of alerts
369
370
        Arguments:
371
            filter: Filter term to use for the query
372
            filter_id: UUID of an existing filter to use for the query
373
            trash: True to request the alerts in the trashcan
374
            tasks: Whether to include the tasks using the alerts
375
        Returns:
376
            The response. See :py:meth:`send_command` for details.
377
        """
378
        cmd = XmlCommand("get_alerts")
379
380
        add_filter(cmd, filter, filter_id)
381
382
        if trash is not None:
383
            cmd.set_attribute("trash", to_bool(trash))
384
385
        if tasks is not None:
386
            cmd.set_attribute("tasks", to_bool(tasks))
387
388
        return self._send_xml_command(cmd)
389
390
    def get_alert(self, alert_id: str, *, tasks: Optional[bool] = None) -> Any:
391
        """Request a single alert