Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3066-3092 (lines=27) @@
3063
        cmd.set_attribute('tag_id', tag_id)
3064
        return self._send_xml_command(cmd)
3065
3066
    def get_targets(self, filter=None, filter_id=None, trash=None,
3067
                    tasks=None):
3068
        """Request a list of targets
3069
3070
        Arguments:
3071
            filter (str, optional): Filter term to use for the query
3072
            filter_id (str, optional): UUID of an existing filter to use for
3073
                the query
3074
            trash (boolean, optional): Whether to get the trashcan targets
3075
                instead
3076
            tasks (boolean, optional): Whether to include list of tasks that
3077
                use the target
3078
3079
        Returns:
3080
            The response. See :py:meth:`send_command` for details.
3081
        """
3082
        cmd = XmlCommand('get_targets')
3083
3084
        _add_filter(cmd, filter, filter_id)
3085
3086
        if not trash is None:
3087
            cmd.set_attribute('trash', _to_bool(trash))
3088
3089
        if not tasks is None:
3090
            cmd.set_attribute('tasks', _to_bool(tasks))
3091
3092
        return self._send_xml_command(cmd)
3093
3094
    def get_target(self, target_id):
3095
        """Request a single target
@@ 2913-2939 (lines=27) @@
2910
        cmd.set_attribute('details', '1')
2911
        return self._send_xml_command(cmd)
2912
2913
    def get_schedules(self, filter=None, filter_id=None, trash=None,
2914
                      tasks=None):
2915
        """Request a list of schedules
2916
2917
        Arguments:
2918
            filter (str, optional): Filter term to use for the query
2919
            filter_id (str, optional): UUID of an existing filter to use for
2920
                the query
2921
            trash (boolean, optional): Whether to get the trashcan schedules
2922
                instead
2923
            tasks (boolean, optional): Whether to include tasks using the
2924
                schedules
2925
2926
        Returns:
2927
            The response. See :py:meth:`send_command` for details.
2928
        """
2929
        cmd = XmlCommand('get_schedules')
2930
2931
        _add_filter(cmd, filter, filter_id)
2932
2933
        if not trash is None:
2934
            cmd.set_attribute('trash', _to_bool(trash))
2935
2936
        if not tasks is None:
2937
            cmd.set_attribute('tasks', _to_bool(tasks))
2938
2939
        return self._send_xml_command(cmd)
2940
2941
    def get_schedule(self, schedule_id):
2942
        """Request a single schedule
@@ 1992-2016 (lines=25) @@
1989
        cmd.set_attributes(kwargs)
1990
        return self._send_xml_command(cmd)
1991
1992
    def get_alerts(self, filter=None, filter_id=None, trash=None, tasks=None):
1993
        """Request a list of alerts
1994
1995
        Arguments:
1996
            filter (str, optional): Filter term to use for the query
1997
            filter_id (str, optional): UUID of an existing filter to use for
1998
                the query
1999
            trash (boolean, optional): True to request the alerts in the
2000
                trashcan
2001
            tasks (boolean, optional): Whether to include the tasks using the
2002
                alerts
2003
        Returns:
2004
            The response. See :py:meth:`send_command` for details.
2005
        """
2006
        cmd = XmlCommand('get_alerts')
2007
2008
        _add_filter(cmd, filter, filter_id)
2009
2010
        if not trash is None:
2011
            cmd.set_attribute('trash', _to_bool(trash))
2012
2013
        if not tasks is None:
2014
            cmd.set_attribute('tasks', _to_bool(tasks))
2015
2016
        return self._send_xml_command(cmd)
2017
2018
    def get_alert(self, alert_id):
2019
        """Request a single alert