Code Duplication    Length = 52-53 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 399-451 (lines=53) @@
396
397
        return self._send_xml_command(cmd)
398
399
    def create_audit(
400
        self,
401
        name: str,
402
        policy_id: str,
403
        target_id: str,
404
        scanner_id: str,
405
        *,
406
        alterable: Optional[bool] = None,
407
        hosts_ordering: Optional[HostsOrdering] = None,
408
        schedule_id: Optional[str] = None,
409
        alert_ids: Optional[List[str]] = None,
410
        comment: Optional[str] = None,
411
        schedule_periods: Optional[int] = None,
412
        observers: Optional[List[str]] = None,
413
        preferences: Optional[dict] = None,
414
    ) -> Any:
415
        """Create a new audit task
416
417
        Arguments:
418
            name: Name of the new audit
419
            policy_id: UUID of policy to use by the audit
420
            target_id: UUID of target to be scanned
421
            scanner_id: UUID of scanner to use for scanning the target
422
            comment: Comment for the audit
423
            alterable: Whether the task should be alterable
424
            alert_ids: List of UUIDs for alerts to be applied to the audit
425
            hosts_ordering: The order hosts are scanned in
426
            schedule_id: UUID of a schedule when the audit should be run.
427
            schedule_periods: A limit to the number of times the audit will be
428
                scheduled, or 0 for no limit
429
            observers: List of names or ids of users which should be allowed to
430
                observe this audit
431
            preferences: Name/Value pairs of scanner preferences.
432
433
        Returns:
434
            The response. See :py:meth:`send_command` for details.
435
        """
436
437
        return self.__create_task(
438
            name=name,
439
            config_id=policy_id,
440
            target_id=target_id,
441
            scanner_id=scanner_id,
442
            usage_type=UsageType.AUDIT,
443
            function=self.create_audit.__name__,
444
            alterable=alterable,
445
            hosts_ordering=hosts_ordering,
446
            schedule_id=schedule_id,
447
            alert_ids=alert_ids,
448
            comment=comment,
449
            schedule_periods=schedule_periods,
450
            observers=observers,
451
            preferences=preferences,
452
        )
453
454
    def create_config(
@@ 693-744 (lines=52) @@
690
691
        return self._send_xml_command(cmd)
692
693
    def create_task(
694
        self,
695
        name: str,
696
        config_id: str,
697
        target_id: str,
698
        scanner_id: str,
699
        *,
700
        alterable: Optional[bool] = None,
701
        hosts_ordering: Optional[HostsOrdering] = None,
702
        schedule_id: Optional[str] = None,
703
        alert_ids: Optional[List[str]] = None,
704
        comment: Optional[str] = None,
705
        schedule_periods: Optional[int] = None,
706
        observers: Optional[List[str]] = None,
707
        preferences: Optional[dict] = None,
708
    ) -> Any:
709
        """Create a new scan task
710
711
        Arguments:
712
            name: Name of the task
713
            config_id: UUID of scan config to use by the task
714
            target_id: UUID of target to be scanned
715
            scanner_id: UUID of scanner to use for scanning the target
716
            comment: Comment for the task
717
            alterable: Whether the task should be alterable
718
            alert_ids: List of UUIDs for alerts to be applied to the task
719
            hosts_ordering: The order hosts are scanned in
720
            schedule_id: UUID of a schedule when the task should be run.
721
            schedule_periods: A limit to the number of times the task will be
722
                scheduled, or 0 for no limit
723
            observers: List of names or ids of users which should be allowed to
724
                observe this task
725
            preferences: Name/Value pairs of scanner preferences.
726
727
        Returns:
728
            The response. See :py:meth:`send_command` for details.
729
        """
730
        return self.__create_task(
731
            name=name,
732
            config_id=config_id,
733
            target_id=target_id,
734
            scanner_id=scanner_id,
735
            usage_type=UsageType.SCAN,
736
            function=self.create_task.__name__,
737
            alterable=alterable,
738
            hosts_ordering=hosts_ordering,
739
            schedule_id=schedule_id,
740
            alert_ids=alert_ids,
741
            comment=comment,
742
            schedule_periods=schedule_periods,
743
            observers=observers,
744
            preferences=preferences,
745
        )
746
747
    def create_tls_certificate(

gvm/protocols/gmpv9/gmpv9.py 2 locations

@@ 272-324 (lines=53) @@
269
270
        return self._send_xml_command(cmd)
271
272
    def create_audit(
273
        self,
274
        name: str,
275
        policy_id: str,
276
        target_id: str,
277
        scanner_id: str,
278
        *,
279
        alterable: Optional[bool] = None,
280
        hosts_ordering: Optional[HostsOrdering] = None,
281
        schedule_id: Optional[str] = None,
282
        alert_ids: Optional[List[str]] = None,
283
        comment: Optional[str] = None,
284
        schedule_periods: Optional[int] = None,
285
        observers: Optional[List[str]] = None,
286
        preferences: Optional[dict] = None,
287
    ) -> Any:
288
        """Create a new audit task
289
290
        Arguments:
291
            name: Name of the new audit
292
            policy_id: UUID of policy to use by the audit
293
            target_id: UUID of target to be scanned
294
            scanner_id: UUID of scanner to use for scanning the target
295
            comment: Comment for the audit
296
            alterable: Whether the task should be alterable
297
            alert_ids: List of UUIDs for alerts to be applied to the audit
298
            hosts_ordering: The order hosts are scanned in
299
            schedule_id: UUID of a schedule when the audit should be run.
300
            schedule_periods: A limit to the number of times the audit will be
301
                scheduled, or 0 for no limit
302
            observers: List of names or ids of users which should be allowed to
303
                observe this audit
304
            preferences: Name/Value pairs of scanner preferences.
305
306
        Returns:
307
            The response. See :py:meth:`send_command` for details.
308
        """
309
310
        return self.__create_task(
311
            name=name,
312
            config_id=policy_id,
313
            target_id=target_id,
314
            scanner_id=scanner_id,
315
            usage_type=UsageType.AUDIT,
316
            function=self.create_audit.__name__,
317
            alterable=alterable,
318
            hosts_ordering=hosts_ordering,
319
            schedule_id=schedule_id,
320
            alert_ids=alert_ids,
321
            comment=comment,
322
            schedule_periods=schedule_periods,
323
            observers=observers,
324
            preferences=preferences,
325
        )
326
327
    def create_config(
@@ 566-617 (lines=52) @@
563
564
        return self._send_xml_command(cmd)
565
566
    def create_task(
567
        self,
568
        name: str,
569
        config_id: str,
570
        target_id: str,
571
        scanner_id: str,
572
        *,
573
        alterable: Optional[bool] = None,
574
        hosts_ordering: Optional[HostsOrdering] = None,
575
        schedule_id: Optional[str] = None,
576
        alert_ids: Optional[List[str]] = None,
577
        comment: Optional[str] = None,
578
        schedule_periods: Optional[int] = None,
579
        observers: Optional[List[str]] = None,
580
        preferences: Optional[dict] = None,
581
    ) -> Any:
582
        """Create a new scan task
583
584
        Arguments:
585
            name: Name of the task
586
            config_id: UUID of scan config to use by the task
587
            target_id: UUID of target to be scanned
588
            scanner_id: UUID of scanner to use for scanning the target
589
            comment: Comment for the task
590
            alterable: Whether the task should be alterable
591
            alert_ids: List of UUIDs for alerts to be applied to the task
592
            hosts_ordering: The order hosts are scanned in
593
            schedule_id: UUID of a schedule when the task should be run.
594
            schedule_periods: A limit to the number of times the task will be
595
                scheduled, or 0 for no limit
596
            observers: List of names or ids of users which should be allowed to
597
                observe this task
598
            preferences: Name/Value pairs of scanner preferences.
599
600
        Returns:
601
            The response. See :py:meth:`send_command` for details.
602
        """
603
        return self.__create_task(
604
            name=name,
605
            config_id=config_id,
606
            target_id=target_id,
607
            scanner_id=scanner_id,
608
            usage_type=UsageType.SCAN,
609
            function=self.create_task.__name__,
610
            alterable=alterable,
611
            hosts_ordering=hosts_ordering,
612
            schedule_id=schedule_id,
613
            alert_ids=alert_ids,
614
            comment=comment,
615
            schedule_periods=schedule_periods,
616
            observers=observers,
617
            preferences=preferences,
618
        )
619
620
    def create_tls_certificate(