Code Duplication    Length = 52-53 lines in 2 locations

gvm/protocols/gmpv9/gmpv9.py 2 locations

@@ 270-322 (lines=53) @@
267
268
        return self._send_xml_command(cmd)
269
270
    def create_audit(
271
        self,
272
        name: str,
273
        policy_id: str,
274
        target_id: str,
275
        scanner_id: str,
276
        *,
277
        alterable: Optional[bool] = None,
278
        hosts_ordering: Optional[HostsOrdering] = None,
279
        schedule_id: Optional[str] = None,
280
        alert_ids: Optional[List[str]] = None,
281
        comment: Optional[str] = None,
282
        schedule_periods: Optional[int] = None,
283
        observers: Optional[List[str]] = None,
284
        preferences: Optional[dict] = None
285
    ) -> Any:
286
        """Create a new audit task
287
288
        Arguments:
289
            name: Name of the new audit
290
            policy_id: UUID of policy to use by the audit
291
            target_id: UUID of target to be scanned
292
            scanner_id: UUID of scanner to use for scanning the target
293
            comment: Comment for the audit
294
            alterable: Whether the task should be alterable
295
            alert_ids: List of UUIDs for alerts to be applied to the audit
296
            hosts_ordering: The order hosts are scanned in
297
            schedule_id: UUID of a schedule when the audit should be run.
298
            schedule_periods: A limit to the number of times the audit will be
299
                scheduled, or 0 for no limit
300
            observers: List of names or ids of users which should be allowed to
301
                observe this audit
302
            preferences: Name/Value pairs of scanner preferences.
303
304
        Returns:
305
            The response. See :py:meth:`send_command` for details.
306
        """
307
308
        return self.__create_task(
309
            name=name,
310
            config_id=policy_id,
311
            target_id=target_id,
312
            scanner_id=scanner_id,
313
            usage_type=UsageType.AUDIT,
314
            function=self.create_audit.__name__,
315
            alterable=alterable,
316
            hosts_ordering=hosts_ordering,
317
            schedule_id=schedule_id,
318
            alert_ids=alert_ids,
319
            comment=comment,
320
            schedule_periods=schedule_periods,
321
            observers=observers,
322
            preferences=preferences,
323
        )
324
325
    def create_config(
@@ 370-421 (lines=52) @@
367
            function=self.create_policy.__name__,
368
        )
369
370
    def create_task(
371
        self,
372
        name: str,
373
        config_id: str,
374
        target_id: str,
375
        scanner_id: str,
376
        *,
377
        alterable: Optional[bool] = None,
378
        hosts_ordering: Optional[HostsOrdering] = None,
379
        schedule_id: Optional[str] = None,
380
        alert_ids: Optional[List[str]] = None,
381
        comment: Optional[str] = None,
382
        schedule_periods: Optional[int] = None,
383
        observers: Optional[List[str]] = None,
384
        preferences: Optional[dict] = None
385
    ) -> Any:
386
        """Create a new scan task
387
388
        Arguments:
389
            name: Name of the task
390
            config_id: UUID of scan config to use by the task
391
            target_id: UUID of target to be scanned
392
            scanner_id: UUID of scanner to use for scanning the target
393
            comment: Comment for the task
394
            alterable: Whether the task should be alterable
395
            alert_ids: List of UUIDs for alerts to be applied to the task
396
            hosts_ordering: The order hosts are scanned in
397
            schedule_id: UUID of a schedule when the task should be run.
398
            schedule_periods: A limit to the number of times the task will be
399
                scheduled, or 0 for no limit
400
            observers: List of names or ids of users which should be allowed to
401
                observe this task
402
            preferences: Name/Value pairs of scanner preferences.
403
404
        Returns:
405
            The response. See :py:meth:`send_command` for details.
406
        """
407
        return self.__create_task(
408
            name=name,
409
            config_id=config_id,
410
            target_id=target_id,
411
            scanner_id=scanner_id,
412
            usage_type=UsageType.SCAN,
413
            function=self.create_task.__name__,
414
            alterable=alterable,
415
            hosts_ordering=hosts_ordering,
416
            schedule_id=schedule_id,
417
            alert_ids=alert_ids,
418
            comment=comment,
419
            schedule_periods=schedule_periods,
420
            observers=observers,
421
            preferences=preferences,
422
        )
423
424
    def create_tls_certificate(