Code Duplication    Length = 52-53 lines in 2 locations

gvm/protocols/gmpv9/__init__.py 2 locations

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