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

@@ 3109-3133 (lines=25) @@
3106
3107
        return self._send_xml_command(cmd)
3108
3109
    def get_groups(
3110
        self,
3111
        *,
3112
        filter: Optional[str] = None,
3113
        filter_id: Optional[str] = None,
3114
        trash: Optional[bool] = None
3115
    ) -> Any:
3116
        """Request a list of groups
3117
3118
        Arguments:
3119
            filter: Filter term to use for the query
3120
            filter_id: UUID of an existing filter to use for the query
3121
            trash: Whether to get the trashcan groups instead
3122
3123
        Returns:
3124
            The response. See :py:meth:`send_command` for details.
3125
        """
3126
        cmd = XmlCommand("get_groups")
3127
3128
        _add_filter(cmd, filter, filter_id)
3129
3130
        if trash is not None:
3131
            cmd.set_attribute("trash", _to_bool(trash))
3132
3133
        return self._send_xml_command(cmd)
3134
3135
    def get_group(self, group_id: str) -> Any:
3136
        """Request a single group
@@ 3832-3856 (lines=25) @@
3829
        cmd.set_attribute("details", "1")
3830
        return self._send_xml_command(cmd)
3831
3832
    def get_roles(
3833
        self,
3834
        *,
3835
        filter: Optional[str] = None,
3836
        filter_id: Optional[str] = None,
3837
        trash: Optional[bool] = None
3838
    ) -> Any:
3839
        """Request a list of roles
3840
3841
        Arguments:
3842
            filter: Filter term to use for the query
3843
            filter_id: UUID of an existing filter to use for the query
3844
            trash: Whether to get the trashcan roles instead
3845
3846
        Returns:
3847
            The response. See :py:meth:`send_command` for details.
3848
        """
3849
        cmd = XmlCommand("get_roles")
3850
3851
        _add_filter(cmd, filter, filter_id)
3852
3853
        if trash is not None:
3854
            cmd.set_attribute("trash", _to_bool(trash))
3855
3856
        return self._send_xml_command(cmd)
3857
3858
    def get_role(self, role_id: str) -> Any:
3859
        """Request a single role
@@ 3446-3470 (lines=25) @@
3443
        cmd.set_attribute("details", "1")
3444
        return self._send_xml_command(cmd)
3445
3446
    def get_permissions(
3447
        self,
3448
        *,
3449
        filter: Optional[str] = None,
3450
        filter_id: Optional[str] = None,
3451
        trash: Optional[bool] = None
3452
    ) -> Any:
3453
        """Request a list of permissions
3454
3455
        Arguments:
3456
            filter: Filter term to use for the query
3457
            filter_id: UUID of an existing filter to use for the query
3458
            trash: Whether to get permissions in the trashcan instead
3459
3460
        Returns:
3461
            The response. See :py:meth:`send_command` for details.
3462
        """
3463
        cmd = XmlCommand("get_permissions")
3464
3465
        _add_filter(cmd, filter, filter_id)
3466
3467
        if trash is not None:
3468
            cmd.set_attribute("trash", _to_bool(trash))
3469
3470
        return self._send_xml_command(cmd)
3471
3472
    def get_permission(self, permission_id: str) -> Any:
3473
        """Request a single permission