Code Duplication    Length = 25-25 lines in 4 locations

gvm/protocols/gmpv8/gmpv8.py 1 location

@@ 742-766 (lines=25) @@
739
740
        return self._send_xml_command(cmd)
741
742
    def get_tickets(
743
        self,
744
        *,
745
        trash: Optional[bool] = None,
746
        filter: Optional[str] = None,
747
        filter_id: Optional[str] = None
748
    ) -> Any:
749
        """Request a list of tickets
750
751
        Arguments:
752
            filter: Filter term to use for the query
753
            filter_id: UUID of an existing filter to use for the query
754
            trash: True to request the tickets in the trashcan
755
756
        Returns:
757
            The response. See :py:meth:`send_command` for details.
758
        """
759
        cmd = XmlCommand("get_tickets")
760
761
        _add_filter(cmd, filter, filter_id)
762
763
        if trash is not None:
764
            cmd.set_attribute("trash", _to_bool(trash))
765
766
        return self._send_xml_command(cmd)
767
768
    def get_ticket(self, ticket_id: str) -> Any:
769
        """Request a single ticket

gvm/protocols/gmpv7/gmpv7.py 3 locations

@@ 3782-3806 (lines=25) @@
3779
        cmd.set_attribute("details", "1")
3780
        return self._send_xml_command(cmd)
3781
3782
    def get_roles(
3783
        self,
3784
        *,
3785
        filter: Optional[str] = None,
3786
        filter_id: Optional[str] = None,
3787
        trash: Optional[bool] = None
3788
    ) -> Any:
3789
        """Request a list of roles
3790
3791
        Arguments:
3792
            filter: Filter term to use for the query
3793
            filter_id: UUID of an existing filter to use for the query
3794
            trash: Whether to get the trashcan roles instead
3795
3796
        Returns:
3797
            The response. See :py:meth:`send_command` for details.
3798
        """
3799
        cmd = XmlCommand("get_roles")
3800
3801
        _add_filter(cmd, filter, filter_id)
3802
3803
        if trash is not None:
3804
            cmd.set_attribute("trash", _to_bool(trash))
3805
3806
        return self._send_xml_command(cmd)
3807
3808
    def get_role(self, role_id: str) -> Any:
3809
        """Request a single role
@@ 3414-3438 (lines=25) @@
3411
        cmd.set_attribute("details", "1")
3412
        return self._send_xml_command(cmd)
3413
3414
    def get_permissions(
3415
        self,
3416
        *,
3417
        filter: Optional[str] = None,
3418
        filter_id: Optional[str] = None,
3419
        trash: Optional[bool] = None
3420
    ) -> Any:
3421
        """Request a list of permissions
3422
3423
        Arguments:
3424
            filter: Filter term to use for the query
3425
            filter_id: UUID of an existing filter to use for the query
3426
            trash: Whether to get permissions in the trashcan instead
3427
3428
        Returns:
3429
            The response. See :py:meth:`send_command` for details.
3430
        """
3431
        cmd = XmlCommand("get_permissions")
3432
3433
        _add_filter(cmd, filter, filter_id)
3434
3435
        if trash is not None:
3436
            cmd.set_attribute("trash", _to_bool(trash))
3437
3438
        return self._send_xml_command(cmd)
3439
3440
    def get_permission(self, permission_id: str) -> Any:
3441
        """Request a single permission
@@ 3082-3106 (lines=25) @@
3079
        cmd.set_attribute("filter_id", filter_id)
3080
        return self._send_xml_command(cmd)
3081
3082
    def get_groups(
3083
        self,
3084
        *,
3085
        filter: Optional[str] = None,
3086
        filter_id: Optional[str] = None,
3087
        trash: Optional[bool] = None
3088
    ) -> Any:
3089
        """Request a list of groups
3090
3091
        Arguments:
3092
            filter: Filter term to use for the query
3093
            filter_id: UUID of an existing filter to use for the query
3094
            trash: Whether to get the trashcan groups instead
3095
3096
        Returns:
3097
            The response. See :py:meth:`send_command` for details.
3098
        """
3099
        cmd = XmlCommand("get_groups")
3100
3101
        _add_filter(cmd, filter, filter_id)
3102
3103
        if trash is not None:
3104
            cmd.set_attribute("trash", _to_bool(trash))
3105
3106
        return self._send_xml_command(cmd)
3107
3108
    def get_group(self, group_id: str) -> Any:
3109
        """Request a single group