Code Duplication    Length = 25-25 lines in 4 locations

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

@@ 186-210 (lines=25) @@
183
184
        return self._send_xml_command(cmd)
185
186
    def get_permissions(
187
        self,
188
        *,
189
        filter: Optional[str] = None,
190
        filter_id: Optional[str] = None,
191
        trash: Optional[bool] = None,
192
    ) -> Any:
193
        """Request a list of permissions
194
195
        Arguments:
196
            filter: Filter term to use for the query
197
            filter_id: UUID of an existing filter to use for the query
198
            trash: Whether to get permissions in the trashcan instead
199
200
        Returns:
201
            The response. See :py:meth:`send_command` for details.
202
        """
203
        cmd = XmlCommand("get_permissions")
204
205
        add_filter(cmd, filter, filter_id)
206
207
        if trash is not None:
208
            cmd.set_attribute("trash", to_bool(trash))
209
210
        return self._send_xml_command(cmd)
211
212
    def get_permission(self, permission_id: str) -> Any:
213
        """Request a single permission

gvm/protocols/gmpv208/gmpv208.py 3 locations

@@ 800-824 (lines=25) @@
797
        cmd.set_attribute("details", "1")
798
        return self._send_xml_command(cmd)
799
800
    def get_roles(
801
        self,
802
        *,
803
        filter: Optional[str] = None,
804
        filter_id: Optional[str] = None,
805
        trash: Optional[bool] = None,
806
    ) -> Any:
807
        """Request a list of roles
808
809
        Arguments:
810
            filter: Filter term to use for the query
811
            filter_id: UUID of an existing filter to use for the query
812
            trash: Whether to get the trashcan roles instead
813
814
        Returns:
815
            The response. See :py:meth:`send_command` for details.
816
        """
817
        cmd = XmlCommand("get_roles")
818
819
        add_filter(cmd, filter, filter_id)
820
821
        if trash is not None:
822
            cmd.set_attribute("trash", to_bool(trash))
823
824
        return self._send_xml_command(cmd)
825
826
    def get_role(self, role_id: str) -> Any:
827
        """Request a single role
@@ 626-650 (lines=25) @@
623
        """
624
        return self._send_xml_command(XmlCommand("empty_trashcan"))
625
626
    def get_groups(
627
        self,
628
        *,
629
        filter: Optional[str] = None,
630
        filter_id: Optional[str] = None,
631
        trash: Optional[bool] = None,
632
    ) -> Any:
633
        """Request a list of groups
634
635
        Arguments:
636
            filter: Filter term to use for the query
637
            filter_id: UUID of an existing filter to use for the query
638
            trash: Whether to get the trashcan groups instead
639
640
        Returns:
641
            The response. See :py:meth:`send_command` for details.
642
        """
643
        cmd = XmlCommand("get_groups")
644
645
        add_filter(cmd, filter, filter_id)
646
647
        if trash is not None:
648
            cmd.set_attribute("trash", to_bool(trash))
649
650
        return self._send_xml_command(cmd)
651
652
    def get_group(self, group_id: str) -> Any:
653
        """Request a single group
@@ 229-253 (lines=25) @@
226
227
        return self._send_xml_command(cmd)
228
229
    def get_tickets(
230
        self,
231
        *,
232
        trash: Optional[bool] = None,
233
        filter: Optional[str] = None,
234
        filter_id: Optional[str] = None,
235
    ) -> Any:
236
        """Request a list of tickets
237
238
        Arguments:
239
            filter: Filter term to use for the query
240
            filter_id: UUID of an existing filter to use for the query
241
            trash: True to request the tickets in the trashcan
242
243
        Returns:
244
            The response. See :py:meth:`send_command` for details.
245
        """
246
        cmd = XmlCommand("get_tickets")
247
248
        add_filter(cmd, filter, filter_id)
249
250
        if trash is not None:
251
            cmd.set_attribute("trash", to_bool(trash))
252
253
        return self._send_xml_command(cmd)
254
255
    def get_ticket(self, ticket_id: str) -> Any:
256
        """Request a single ticket