Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 2069-2093 (lines=25) @@
2066
        cmd.set_attributes(kwargs)
2067
        return self._send_xml_command(cmd)
2068
2069
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2070
                   tasks=None):
2071
        """Request a list of alerts
2072
2073
        Arguments:
2074
            filter (str, optional): Filter term to use for the query
2075
            filter_id (str, optional): UUID of an existing filter to use for
2076
                the query
2077
            trash (boolean, optional): True to request the alerts in the
2078
                trashcan
2079
            tasks (boolean, optional): Whether to include the tasks using the
2080
                alerts
2081
        Returns:
2082
            The response. See :py:meth:`send_command` for details.
2083
        """
2084
        cmd = XmlCommand('get_alerts')
2085
2086
        _add_filter(cmd, filter, filter_id)
2087
2088
        if not trash is None:
2089
            cmd.set_attribute('trash', _to_bool(trash))
2090
2091
        if not tasks is None:
2092
            cmd.set_attribute('tasks', _to_bool(tasks))
2093
2094
        return self._send_xml_command(cmd)
2095
2096
    def get_alert(self, alert_id):
@@ 3143-3169 (lines=27) @@
3140
        cmd.set_attribute('tag_id', tag_id)
3141
        return self._send_xml_command(cmd)
3142
3143
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3144
                    tasks=None):
3145
        """Request a list of targets
3146
3147
        Arguments:
3148
            filter (str, optional): Filter term to use for the query
3149
            filter_id (str, optional): UUID of an existing filter to use for
3150
                the query
3151
            trash (boolean, optional): Whether to get the trashcan targets
3152
                instead
3153
            tasks (boolean, optional): Whether to include list of tasks that
3154
                use the target
3155
3156
        Returns:
3157
            The response. See :py:meth:`send_command` for details.
3158
        """
3159
        cmd = XmlCommand('get_targets')
3160
3161
        _add_filter(cmd, filter, filter_id)
3162
3163
        if not trash is None:
3164
            cmd.set_attribute('trash', _to_bool(trash))
3165
3166
        if not tasks is None:
3167
            cmd.set_attribute('tasks', _to_bool(tasks))
3168
3169
        return self._send_xml_command(cmd)
3170
3171
    def get_target(self, target_id):
3172
        """Request a single target
@@ 2990-3016 (lines=27) @@
2987
        cmd.set_attribute('details', '1')
2988
        return self._send_xml_command(cmd)
2989
2990
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
2991
                      tasks=None):
2992
        """Request a list of schedules
2993
2994
        Arguments:
2995
            filter (str, optional): Filter term to use for the query
2996
            filter_id (str, optional): UUID of an existing filter to use for
2997
                the query
2998
            trash (boolean, optional): Whether to get the trashcan schedules
2999
                instead
3000
            tasks (boolean, optional): Whether to include tasks using the
3001
                schedules
3002
3003
        Returns:
3004
            The response. See :py:meth:`send_command` for details.
3005
        """
3006
        cmd = XmlCommand('get_schedules')
3007
3008
        _add_filter(cmd, filter, filter_id)
3009
3010
        if not trash is None:
3011
            cmd.set_attribute('trash', _to_bool(trash))
3012
3013
        if not tasks is None:
3014
            cmd.set_attribute('tasks', _to_bool(tasks))
3015
3016
        return self._send_xml_command(cmd)
3017
3018
    def get_schedule(self, schedule_id):
3019
        """Request a single schedule