Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 2028-2052 (lines=25) @@
2025
        cmd.set_attributes(kwargs)
2026
        return self._send_xml_command(cmd)
2027
2028
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2029
                   tasks=None):
2030
        """Request a list of alerts
2031
2032
        Arguments:
2033
            filter (str, optional): Filter term to use for the query
2034
            filter_id (str, optional): UUID of an existing filter to use for
2035
                the query
2036
            trash (boolean, optional): True to request the alerts in the
2037
                trashcan
2038
            tasks (boolean, optional): Whether to include the tasks using the
2039
                alerts
2040
        Returns:
2041
            The response. See :py:meth:`send_command` for details.
2042
        """
2043
        cmd = XmlCommand('get_alerts')
2044
2045
        _add_filter(cmd, filter, filter_id)
2046
2047
        if not trash is None:
2048
            cmd.set_attribute('trash', _to_bool(trash))
2049
2050
        if not tasks is None:
2051
            cmd.set_attribute('tasks', _to_bool(tasks))
2052
2053
        return self._send_xml_command(cmd)
2054
2055
    def get_alert(self, alert_id):
@@ 3099-3125 (lines=27) @@
3096
        cmd.set_attribute('tag_id', tag_id)
3097
        return self._send_xml_command(cmd)
3098
3099
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3100
                    tasks=None):
3101
        """Request a list of targets
3102
3103
        Arguments:
3104
            filter (str, optional): Filter term to use for the query
3105
            filter_id (str, optional): UUID of an existing filter to use for
3106
                the query
3107
            trash (boolean, optional): Whether to get the trashcan targets
3108
                instead
3109
            tasks (boolean, optional): Whether to include list of tasks that
3110
                use the target
3111
3112
        Returns:
3113
            The response. See :py:meth:`send_command` for details.
3114
        """
3115
        cmd = XmlCommand('get_targets')
3116
3117
        _add_filter(cmd, filter, filter_id)
3118
3119
        if not trash is None:
3120
            cmd.set_attribute('trash', _to_bool(trash))
3121
3122
        if not tasks is None:
3123
            cmd.set_attribute('tasks', _to_bool(tasks))
3124
3125
        return self._send_xml_command(cmd)
3126
3127
    def get_target(self, target_id):
3128
        """Request a single target
@@ 2946-2972 (lines=27) @@
2943
        cmd.set_attribute('details', '1')
2944
        return self._send_xml_command(cmd)
2945
2946
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
2947
                      tasks=None):
2948
        """Request a list of schedules
2949
2950
        Arguments:
2951
            filter (str, optional): Filter term to use for the query
2952
            filter_id (str, optional): UUID of an existing filter to use for
2953
                the query
2954
            trash (boolean, optional): Whether to get the trashcan schedules
2955
                instead
2956
            tasks (boolean, optional): Whether to include tasks using the
2957
                schedules
2958
2959
        Returns:
2960
            The response. See :py:meth:`send_command` for details.
2961
        """
2962
        cmd = XmlCommand('get_schedules')
2963
2964
        _add_filter(cmd, filter, filter_id)
2965
2966
        if not trash is None:
2967
            cmd.set_attribute('trash', _to_bool(trash))
2968
2969
        if not tasks is None:
2970
            cmd.set_attribute('tasks', _to_bool(tasks))
2971
2972
        return self._send_xml_command(cmd)
2973
2974
    def get_schedule(self, schedule_id):
2975
        """Request a single schedule