Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3439-3465 (lines=27) @@
3436
        cmd.set_attribute('tag_id', tag_id)
3437
        return self._send_xml_command(cmd)
3438
3439
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3440
                    tasks=None):
3441
        """Request a list of targets
3442
3443
        Arguments:
3444
            filter (str, optional): Filter term to use for the query
3445
            filter_id (str, optional): UUID of an existing filter to use for
3446
                the query
3447
            trash (boolean, optional): Whether to get the trashcan targets
3448
                instead
3449
            tasks (boolean, optional): Whether to include list of tasks that
3450
                use the target
3451
3452
        Returns:
3453
            The response. See :py:meth:`send_command` for details.
3454
        """
3455
        cmd = XmlCommand('get_targets')
3456
3457
        _add_filter(cmd, filter, filter_id)
3458
3459
        if not trash is None:
3460
            cmd.set_attribute('trash', _to_bool(trash))
3461
3462
        if not tasks is None:
3463
            cmd.set_attribute('tasks', _to_bool(tasks))
3464
3465
        return self._send_xml_command(cmd)
3466
3467
    def get_target(self, target_id):
3468
        """Request a single target
@@ 3266-3292 (lines=27) @@
3263
        cmd.set_attribute('details', '1')
3264
        return self._send_xml_command(cmd)
3265
3266
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
3267
                      tasks=None):
3268
        """Request a list of schedules
3269
3270
        Arguments:
3271
            filter (str, optional): Filter term to use for the query
3272
            filter_id (str, optional): UUID of an existing filter to use for
3273
                the query
3274
            trash (boolean, optional): Whether to get the trashcan schedules
3275
                instead
3276
            tasks (boolean, optional): Whether to include tasks using the
3277
                schedules
3278
3279
        Returns:
3280
            The response. See :py:meth:`send_command` for details.
3281
        """
3282
        cmd = XmlCommand('get_schedules')
3283
3284
        _add_filter(cmd, filter, filter_id)
3285
3286
        if not trash is None:
3287
            cmd.set_attribute('trash', _to_bool(trash))
3288
3289
        if not tasks is None:
3290
            cmd.set_attribute('tasks', _to_bool(tasks))
3291
3292
        return self._send_xml_command(cmd)
3293
3294
    def get_schedule(self, schedule_id):
3295
        """Request a single schedule
@@ 2268-2292 (lines=25) @@
2265
        cmd.set_attributes(kwargs)
2266
        return self._send_xml_command(cmd)
2267
2268
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2269
                   tasks=None):
2270
        """Request a list of alerts
2271
2272
        Arguments:
2273
            filter (str, optional): Filter term to use for the query
2274
            filter_id (str, optional): UUID of an existing filter to use for
2275
                the query
2276
            trash (boolean, optional): True to request the alerts in the
2277
                trashcan
2278
            tasks (boolean, optional): Whether to include the tasks using the
2279
                alerts
2280
        Returns:
2281
            The response. See :py:meth:`send_command` for details.
2282
        """
2283
        cmd = XmlCommand('get_alerts')
2284
2285
        _add_filter(cmd, filter, filter_id)
2286
2287
        if not trash is None:
2288
            cmd.set_attribute('trash', _to_bool(trash))
2289
2290
        if not tasks is None:
2291
            cmd.set_attribute('tasks', _to_bool(tasks))
2292
2293
        return self._send_xml_command(cmd)
2294
2295
    def get_alert(self, alert_id):