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

@@ 3225-3273 (lines=49) @@
3222
3223
        return self._send_xml_command(cmd)
3224
3225
    def modify_schedule(
3226
        self,
3227
        schedule_id: str,
3228
        *,
3229
        name: Optional[str] = None,
3230
        icalendar: Optional[str] = None,
3231
        timezone: Optional[str] = None,
3232
        comment: Optional[str] = None,
3233
    ) -> Any:
3234
        """Modifies an existing schedule
3235
3236
        Arguments:
3237
            schedule_id: UUID of the schedule to be modified
3238
            name: Name of the schedule
3239
            icalendar: `iCalendar`_ (RFC 5545) based data.
3240
            timezone: Timezone to use for the icalender events e.g
3241
                Europe/Berlin. If the datetime values in the icalendar data are
3242
                missing timezone information this timezone gets applied.
3243
                Otherwise the datetime values from the icalendar data are
3244
                displayed in this timezone
3245
            commenhedule.
3246
3247
        Returns:
3248
            The response. See :py:meth:`send_command` for details.
3249
3250
        .. _iCalendar:
3251
            https://tools.ietf.org/html/rfc5545
3252
        """
3253
        if not schedule_id:
3254
            raise RequiredArgument(
3255
                function=self.modify_schedule.__name__, argument='schedule_id'
3256
            )
3257
3258
        cmd = XmlCommand("modify_schedule")
3259
        cmd.set_attribute("schedule_id", schedule_id)
3260
3261
        if name:
3262
            cmd.add_element("name", name)
3263
3264
        if icalendar:
3265
            cmd.add_element("icalendar", icalendar)
3266
3267
        if timezone:
3268
            cmd.add_element("timezone", timezone)
3269
3270
        if comment:
3271
            cmd.add_element("comment", comment)
3272
3273
        return self._send_xml_command(cmd)
3274
3275
    def clone_config(self, config_id: str) -> Any:
3276
        """Clone a scan config from an existing one