Code Duplication    Length = 52-53 lines in 2 locations

gvm/protocols/gmpv9/__init__.py 2 locations

@@ 61-113 (lines=53) @@
58
        """
59
        return PROTOCOL_VERSION
60
61
    def create_audit(
62
        self,
63
        name: str,
64
        audit_id: str,
65
        target_id: str,
66
        scanner_id: str,
67
        *,
68
        alterable: Optional[bool] = None,
69
        hosts_ordering: Optional[HostsOrdering] = None,
70
        schedule_id: Optional[str] = None,
71
        alert_ids: Optional[List[str]] = None,
72
        comment: Optional[str] = None,
73
        schedule_periods: Optional[int] = None,
74
        observers: Optional[List[str]] = None,
75
        preferences: Optional[dict] = None
76
    ) -> Any:
77
        """Create a new audit task
78
79
        Arguments:
80
            name: Name of the new audit
81
            audit_id: UUID of scan config to use by the audit
82
            target_id: UUID of target to be scanned
83
            scanner_id: UUID of scanner to use for scanning the target
84
            comment: Comment for the audit
85
            alterable: Whether the task should be alterable
86
            alert_ids: List of UUIDs for alerts to be applied to the audit
87
            hosts_ordering: The order hosts are scanned in
88
            schedule_id: UUID of a schedule when the audit should be run.
89
            schedule_periods: A limit to the number of times the audit will be
90
                scheduled, or 0 for no limit
91
            observers: List of names or ids of users which should be allowed to
92
                observe this audit
93
            preferences: Name/Value pairs of scanner preferences.
94
95
        Returns:
96
            The response. See :py:meth:`send_command` for details.
97
        """
98
99
        self.__create_task(
100
            name=name,
101
            config_id=audit_id,
102
            target_id=target_id,
103
            scanner_id=scanner_id,
104
            usage_type=UsageType.AUDIT,  # pylint: disable=W0212
105
            function=self.create_audit.__name__,
106
            alterable=alterable,
107
            hosts_ordering=hosts_ordering,
108
            schedule_id=schedule_id,
109
            alert_ids=alert_ids,
110
            comment=comment,
111
            schedule_periods=schedule_periods,
112
            observers=observers,
113
            preferences=preferences,
114
        )
115
116
    def create_config(self, config_id: str, name: str) -> Any:
@@ 148-199 (lines=52) @@
145
            function=self.create_policy.__name__,
146
        )
147
148
    def create_task(
149
        self,
150
        name: str,
151
        config_id: str,
152
        target_id: str,
153
        scanner_id: str,
154
        *,
155
        alterable: Optional[bool] = None,
156
        hosts_ordering: Optional[HostsOrdering] = None,
157
        schedule_id: Optional[str] = None,
158
        alert_ids: Optional[List[str]] = None,
159
        comment: Optional[str] = None,
160
        schedule_periods: Optional[int] = None,
161
        observers: Optional[List[str]] = None,
162
        preferences: Optional[dict] = None
163
    ) -> Any:
164
        """Create a new scan task
165
166
        Arguments:
167
            name: Name of the task
168
            config_id: UUID of scan config to use by the task
169
            target_id: UUID of target to be scanned
170
            scanner_id: UUID of scanner to use for scanning the target
171
            comment: Comment for the task
172
            alterable: Whether the task should be alterable
173
            alert_ids: List of UUIDs for alerts to be applied to the task
174
            hosts_ordering: The order hosts are scanned in
175
            schedule_id: UUID of a schedule when the task should be run.
176
            schedule_periods: A limit to the number of times the task will be
177
                scheduled, or 0 for no limit
178
            observers: List of names or ids of users which should be allowed to
179
                observe this task
180
            preferences: Name/Value pairs of scanner preferences.
181
182
        Returns:
183
            The response. See :py:meth:`send_command` for details.
184
        """
185
        self.__create_task(
186
            name=name,
187
            config_id=config_id,
188
            target_id=target_id,
189
            scanner_id=scanner_id,
190
            usage_type=UsageType.SCAN,  # pylint: disable=W0212
191
            function=self.create_task.__name__,
192
            alterable=alterable,
193
            hosts_ordering=hosts_ordering,
194
            schedule_id=schedule_id,
195
            alert_ids=alert_ids,
196
            comment=comment,
197
            schedule_periods=schedule_periods,
198
            observers=observers,
199
            preferences=preferences,
200
        )
201
202
    def create_tls_certificate(