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

@@ 3890-3914 (lines=25) @@
3887
        cmd.set_attribute("details", "1")
3888
        return self._send_xml_command(cmd)
3889
3890
    def get_roles(
3891
        self,
3892
        *,
3893
        filter: Optional[str] = None,
3894
        filter_id: Optional[str] = None,
3895
        trash: Optional[bool] = None
3896
    ) -> Any:
3897
        """Request a list of roles
3898
3899
        Arguments:
3900
            filter: Filter term to use for the query
3901
            filter_id: UUID of an existing filter to use for the query
3902
            trash: Whether to get the trashcan roles instead
3903
3904
        Returns:
3905
            The response. See :py:meth:`send_command` for details.
3906
        """
3907
        cmd = XmlCommand("get_roles")
3908
3909
        _add_filter(cmd, filter, filter_id)
3910
3911
        if trash is not None:
3912
            cmd.set_attribute("trash", _to_bool(trash))
3913
3914
        return self._send_xml_command(cmd)
3915
3916
    def get_role(self, role_id: str) -> Any:
3917
        """Request a single role
@@ 3504-3528 (lines=25) @@
3501
        cmd.set_attribute("details", "1")
3502
        return self._send_xml_command(cmd)
3503
3504
    def get_permissions(
3505
        self,
3506
        *,
3507
        filter: Optional[str] = None,
3508
        filter_id: Optional[str] = None,
3509
        trash: Optional[bool] = None
3510
    ) -> Any:
3511
        """Request a list of permissions
3512
3513
        Arguments:
3514
            filter: Filter term to use for the query
3515
            filter_id: UUID of an existing filter to use for the query
3516
            trash: Whether to get permissions in the trashcan instead
3517
3518
        Returns:
3519
            The response. See :py:meth:`send_command` for details.
3520
        """
3521
        cmd = XmlCommand("get_permissions")
3522
3523
        _add_filter(cmd, filter, filter_id)
3524
3525
        if trash is not None:
3526
            cmd.set_attribute("trash", _to_bool(trash))
3527
3528
        return self._send_xml_command(cmd)
3529
3530
    def get_permission(self, permission_id: str) -> Any:
3531
        """Request a single permission
@@ 3167-3191 (lines=25) @@
3164
3165
        return self._send_xml_command(cmd)
3166
3167
    def get_groups(
3168
        self,
3169
        *,
3170
        filter: Optional[str] = None,
3171
        filter_id: Optional[str] = None,
3172
        trash: Optional[bool] = None
3173
    ) -> Any:
3174
        """Request a list of groups
3175
3176
        Arguments:
3177
            filter: Filter term to use for the query
3178
            filter_id: UUID of an existing filter to use for the query
3179
            trash: Whether to get the trashcan groups instead
3180
3181
        Returns:
3182
            The response. See :py:meth:`send_command` for details.
3183
        """
3184
        cmd = XmlCommand("get_groups")
3185
3186
        _add_filter(cmd, filter, filter_id)
3187
3188
        if trash is not None:
3189
            cmd.set_attribute("trash", _to_bool(trash))
3190
3191
        return self._send_xml_command(cmd)
3192
3193
    def get_group(self, group_id: str) -> Any:
3194
        """Request a single group