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

@@ 3183-3207 (lines=25) @@
3180
3181
        return self._send_xml_command(cmd)
3182
3183
    def get_groups(
3184
        self,
3185
        *,
3186
        filter: Optional[str] = None,
3187
        filter_id: Optional[str] = None,
3188
        trash: Optional[bool] = None
3189
    ) -> Any:
3190
        """Request a list of groups
3191
3192
        Arguments:
3193
            filter: Filter term to use for the query
3194
            filter_id: UUID of an existing filter to use for the query
3195
            trash: Whether to get the trashcan groups instead
3196
3197
        Returns:
3198
            The response. See :py:meth:`send_command` for details.
3199
        """
3200
        cmd = XmlCommand("get_groups")
3201
3202
        _add_filter(cmd, filter, filter_id)
3203
3204
        if trash is not None:
3205
            cmd.set_attribute("trash", _to_bool(trash))
3206
3207
        return self._send_xml_command(cmd)
3208
3209
    def get_group(self, group_id: str) -> Any:
3210
        """Request a single group
@@ 3920-3944 (lines=25) @@
3917
        cmd.set_attribute("details", "1")
3918
        return self._send_xml_command(cmd)
3919
3920
    def get_roles(
3921
        self,
3922
        *,
3923
        filter: Optional[str] = None,
3924
        filter_id: Optional[str] = None,
3925
        trash: Optional[bool] = None
3926
    ) -> Any:
3927
        """Request a list of roles
3928
3929
        Arguments:
3930
            filter: Filter term to use for the query
3931
            filter_id: UUID of an existing filter to use for the query
3932
            trash: Whether to get the trashcan roles instead
3933
3934
        Returns:
3935
            The response. See :py:meth:`send_command` for details.
3936
        """
3937
        cmd = XmlCommand("get_roles")
3938
3939
        _add_filter(cmd, filter, filter_id)
3940
3941
        if trash is not None:
3942
            cmd.set_attribute("trash", _to_bool(trash))
3943
3944
        return self._send_xml_command(cmd)
3945
3946
    def get_role(self, role_id: str) -> Any:
3947
        """Request a single role
@@ 3523-3547 (lines=25) @@
3520
        cmd.set_attribute("details", "1")
3521
        return self._send_xml_command(cmd)
3522
3523
    def get_permissions(
3524
        self,
3525
        *,
3526
        filter: Optional[str] = None,
3527
        filter_id: Optional[str] = None,
3528
        trash: Optional[bool] = None
3529
    ) -> Any:
3530
        """Request a list of permissions
3531
3532
        Arguments:
3533
            filter: Filter term to use for the query
3534
            filter_id: UUID of an existing filter to use for the query
3535
            trash: Whether to get permissions in the trashcan instead
3536
3537
        Returns:
3538
            The response. See :py:meth:`send_command` for details.
3539
        """
3540
        cmd = XmlCommand("get_permissions")
3541
3542
        _add_filter(cmd, filter, filter_id)
3543
3544
        if trash is not None:
3545
            cmd.set_attribute("trash", _to_bool(trash))
3546
3547
        return self._send_xml_command(cmd)
3548
3549
    def get_permission(self, permission_id: str) -> Any:
3550
        """Request a single permission