Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3006-3032 (lines=27) @@
3003
        cmd.set_attribute('tag_id', tag_id)
3004
        return self._send_xml_command(cmd)
3005
3006
    def get_targets(self, filter=None, filter_id=None, trash=None,
3007
                    tasks=None):
3008
        """Request a list of targets
3009
3010
        Arguments:
3011
            filter (str, optional): Filter term to use for the query
3012
            filter_id (str, optional): UUID of an existing filter to use for
3013
                the query
3014
            trash (boolean, optional): Whether to get the trashcan targets
3015
                instead
3016
            tasks (boolean, optional): Whether to include list of tasks that
3017
                use the target
3018
3019
        Returns:
3020
            The response. See :py:meth:`send_command` for details.
3021
        """
3022
        cmd = XmlCommand('get_targets')
3023
3024
        _add_filter(cmd, filter, filter_id)
3025
3026
        if not trash is None:
3027
            cmd.set_attribute('trash', _to_bool(trash))
3028
3029
        if not tasks is None:
3030
            cmd.set_attribute('tasks', _to_bool(tasks))
3031
3032
        return self._send_xml_command(cmd)
3033
3034
    def get_target(self, target_id):
3035
        """Request a single target
@@ 2853-2879 (lines=27) @@
2850
        cmd.set_attribute('details', '1')
2851
        return self._send_xml_command(cmd)
2852
2853
    def get_schedules(self, filter=None, filter_id=None, trash=None,
2854
                      tasks=None):
2855
        """Request a list of schedules
2856
2857
        Arguments:
2858
            filter (str, optional): Filter term to use for the query
2859
            filter_id (str, optional): UUID of an existing filter to use for
2860
                the query
2861
            trash (boolean, optional): Whether to get the trashcan schedules
2862
                instead
2863
            tasks (boolean, optional): Whether to include tasks using the
2864
                schedules
2865
2866
        Returns:
2867
            The response. See :py:meth:`send_command` for details.
2868
        """
2869
        cmd = XmlCommand('get_schedules')
2870
2871
        _add_filter(cmd, filter, filter_id)
2872
2873
        if not trash is None:
2874
            cmd.set_attribute('trash', _to_bool(trash))
2875
2876
        if not tasks is None:
2877
            cmd.set_attribute('tasks', _to_bool(tasks))
2878
2879
        return self._send_xml_command(cmd)
2880
2881
    def get_schedule(self, schedule_id):
2882
        """Request a single schedule
@@ 1932-1956 (lines=25) @@
1929
        cmd.set_attributes(kwargs)
1930
        return self._send_xml_command(cmd)
1931
1932
    def get_alerts(self, filter=None, filter_id=None, trash=None, tasks=None):
1933
        """Request a list of alerts
1934
1935
        Arguments:
1936
            filter (str, optional): Filter term to use for the query
1937
            filter_id (str, optional): UUID of an existing filter to use for
1938
                the query
1939
            trash (boolean, optional): True to request the alerts in the
1940
                trashcan
1941
            tasks (boolean, optional): Whether to include the tasks using the
1942
                alerts
1943
        Returns:
1944
            The response. See :py:meth:`send_command` for details.
1945
        """
1946
        cmd = XmlCommand('get_alerts')
1947
1948
        _add_filter(cmd, filter, filter_id)
1949
1950
        if not trash is None:
1951
            cmd.set_attribute('trash', _to_bool(trash))
1952
1953
        if not tasks is None:
1954
            cmd.set_attribute('tasks', _to_bool(tasks))
1955
1956
        return self._send_xml_command(cmd)
1957
1958
    def get_alert(self, alert_id):
1959
        """Request a single alert