Code Duplication    Length = 49-49 lines in 2 locations

gvm/protocols/gmpv8/gmpv8.py 1 location

@@ 1056-1104 (lines=49) @@
1053
1054
        return self._send_xml_command(cmd)
1055
1056
    def modify_schedule(
1057
        self,
1058
        schedule_id: str,
1059
        *,
1060
        name: Optional[str] = None,
1061
        icalendar: Optional[str] = None,
1062
        timezone: Optional[str] = None,
1063
        comment: Optional[str] = None,
1064
    ) -> Any:
1065
        """Modifies an existing schedule
1066
1067
        Arguments:
1068
            schedule_id: UUID of the schedule to be modified
1069
            name: Name of the schedule
1070
            icalendar: `iCalendar`_ (RFC 5545) based data.
1071
            timezone: Timezone to use for the icalender events e.g
1072
                Europe/Berlin. If the datetime values in the icalendar data are
1073
                missing timezone information this timezone gets applied.
1074
                Otherwise the datetime values from the icalendar data are
1075
                displayed in this timezone
1076
            commenhedule.
1077
1078
        Returns:
1079
            The response. See :py:meth:`send_command` for details.
1080
1081
        .. _iCalendar:
1082
            https://tools.ietf.org/html/rfc5545
1083
        """
1084
        if not schedule_id:
1085
            raise RequiredArgument(
1086
                function=self.modify_schedule.__name__, argument='schedule_id'
1087
            )
1088
1089
        cmd = XmlCommand("modify_schedule")
1090
        cmd.set_attribute("schedule_id", schedule_id)
1091
1092
        if name:
1093
            cmd.add_element("name", name)
1094
1095
        if icalendar:
1096
            cmd.add_element("icalendar", icalendar)
1097
1098
        if timezone:
1099
            cmd.add_element("timezone", timezone)
1100
1101
        if comment:
1102
            cmd.add_element("comment", comment)
1103
1104
        return self._send_xml_command(cmd)
1105

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 3257-3305 (lines=49) @@
3254
3255
        return self._send_xml_command(cmd)
3256
3257
    def modify_schedule(
3258
        self,
3259
        schedule_id: str,
3260
        *,
3261
        name: Optional[str] = None,
3262
        icalendar: Optional[str] = None,
3263
        timezone: Optional[str] = None,
3264
        comment: Optional[str] = None,
3265
    ) -> Any:
3266
        """Modifies an existing schedule
3267
3268
        Arguments:
3269
            schedule_id: UUID of the schedule to be modified
3270
            name: Name of the schedule
3271
            icalendar: `iCalendar`_ (RFC 5545) based data.
3272
            timezone: Timezone to use for the icalender events e.g
3273
                Europe/Berlin. If the datetime values in the icalendar data are
3274
                missing timezone information this timezone gets applied.
3275
                Otherwise the datetime values from the icalendar data are
3276
                displayed in this timezone
3277
            commenhedule.
3278
3279
        Returns:
3280
            The response. See :py:meth:`send_command` for details.
3281
3282
        .. _iCalendar:
3283
            https://tools.ietf.org/html/rfc5545
3284
        """
3285
        if not schedule_id:
3286
            raise RequiredArgument(
3287
                function=self.modify_schedule.__name__, argument='schedule_id'
3288
            )
3289
3290
        cmd = XmlCommand("modify_schedule")
3291
        cmd.set_attribute("schedule_id", schedule_id)
3292
3293
        if name:
3294
            cmd.add_element("name", name)
3295
3296
        if icalendar:
3297
            cmd.add_element("icalendar", icalendar)
3298
3299
        if timezone:
3300
            cmd.add_element("timezone", timezone)
3301
3302
        if comment:
3303
            cmd.add_element("comment", comment)
3304
3305
        return self._send_xml_command(cmd)
3306
3307
    def clone_config(self, config_id: str) -> Any:
3308
        """Clone a scan config from an existing one