Code Duplication    Length = 35-36 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4126-4161 (lines=36) @@
4123
4124
        return self._send_xml_command(cmd)
4125
4126
    def get_credentials(
4127
        self,
4128
        *,
4129
        filter: Optional[str] = None,
4130
        filter_id: Optional[str] = None,
4131
        scanners: Optional[bool] = None,
4132
        trash: Optional[bool] = None,
4133
        targets: Optional[bool] = None,
4134
    ) -> Any:
4135
        """Request a list of credentials
4136
4137
        Arguments:
4138
            filter: Filter term to use for the query
4139
            filter_id: UUID of an existing filter to use for the query
4140
            scanners: Whether to include a list of scanners using the
4141
                credentials
4142
            trash: Whether to get the trashcan credentials instead
4143
            targets: Whether to include a list of targets using the credentials
4144
4145
        Returns:
4146
            The response. See :py:meth:`send_command` for details.
4147
        """
4148
        cmd = XmlCommand("get_credentials")
4149
4150
        add_filter(cmd, filter, filter_id)
4151
4152
        if scanners is not None:
4153
            cmd.set_attribute("scanners", to_bool(scanners))
4154
4155
        if trash is not None:
4156
            cmd.set_attribute("trash", to_bool(trash))
4157
4158
        if targets is not None:
4159
            cmd.set_attribute("targets", to_bool(targets))
4160
4161
        return self._send_xml_command(cmd)
4162
4163
    def get_credential(
4164
        self,

gvm/protocols/gmpv208/entities/port_lists.py 1 location

@@ 207-241 (lines=35) @@
204
205
        return self._send_xml_command(cmd)
206
207
    def get_port_lists(
208
        self,
209
        *,
210
        filter: Optional[str] = None,
211
        filter_id: Optional[str] = None,
212
        details: Optional[bool] = None,
213
        targets: Optional[bool] = None,
214
        trash: Optional[bool] = None,
215
    ) -> Any:
216
        """Request a list of port lists
217
218
        Arguments:
219
            filter: Filter term to use for the query
220
            filter_id: UUID of an existing filter to use for the query
221
            details: Whether to include full port list details
222
            targets: Whether to include targets using this port list
223
            trash: Whether to get port lists in the trashcan instead
224
225
        Returns:
226
            The response. See :py:meth:`send_command` for details.
227
        """
228
        cmd = XmlCommand("get_port_lists")
229
230
        add_filter(cmd, filter, filter_id)
231
232
        if details is not None:
233
            cmd.set_attribute("details", to_bool(details))
234
235
        if targets is not None:
236
            cmd.set_attribute("targets", to_bool(targets))
237
238
        if trash is not None:
239
            cmd.set_attribute("trash", to_bool(trash))
240
241
        return self._send_xml_command(cmd)
242
243
    def get_port_list(self, port_list_id: str):
244
        """Request a single port list