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

@@ 3843-3867 (lines=25) @@
3840
        cmd.set_attribute("details", "1")
3841
        return self._send_xml_command(cmd)
3842
3843
    def get_roles(
3844
        self,
3845
        *,
3846
        filter: Optional[str] = None,
3847
        filter_id: Optional[str] = None,
3848
        trash: Optional[bool] = None
3849
    ) -> Any:
3850
        """Request a list of roles
3851
3852
        Arguments:
3853
            filter: Filter term to use for the query
3854
            filter_id: UUID of an existing filter to use for the query
3855
            trash: Whether to get the trashcan roles instead
3856
3857
        Returns:
3858
            The response. See :py:meth:`send_command` for details.
3859
        """
3860
        cmd = XmlCommand("get_roles")
3861
3862
        _add_filter(cmd, filter, filter_id)
3863
3864
        if trash is not None:
3865
            cmd.set_attribute("trash", _to_bool(trash))
3866
3867
        return self._send_xml_command(cmd)
3868
3869
    def get_role(self, role_id: str) -> Any:
3870
        """Request a single role
@@ 3457-3481 (lines=25) @@
3454
        cmd.set_attribute("details", "1")
3455
        return self._send_xml_command(cmd)
3456
3457
    def get_permissions(
3458
        self,
3459
        *,
3460
        filter: Optional[str] = None,
3461
        filter_id: Optional[str] = None,
3462
        trash: Optional[bool] = None
3463
    ) -> Any:
3464
        """Request a list of permissions
3465
3466
        Arguments:
3467
            filter: Filter term to use for the query
3468
            filter_id: UUID of an existing filter to use for the query
3469
            trash: Whether to get permissions in the trashcan instead
3470
3471
        Returns:
3472
            The response. See :py:meth:`send_command` for details.
3473
        """
3474
        cmd = XmlCommand("get_permissions")
3475
3476
        _add_filter(cmd, filter, filter_id)
3477
3478
        if trash is not None:
3479
            cmd.set_attribute("trash", _to_bool(trash))
3480
3481
        return self._send_xml_command(cmd)
3482
3483
    def get_permission(self, permission_id: str) -> Any:
3484
        """Request a single permission
@@ 3120-3144 (lines=25) @@
3117
3118
        return self._send_xml_command(cmd)
3119
3120
    def get_groups(
3121
        self,
3122
        *,
3123
        filter: Optional[str] = None,
3124
        filter_id: Optional[str] = None,
3125
        trash: Optional[bool] = None
3126
    ) -> Any:
3127
        """Request a list of groups
3128
3129
        Arguments:
3130
            filter: Filter term to use for the query
3131
            filter_id: UUID of an existing filter to use for the query
3132
            trash: Whether to get the trashcan groups instead
3133
3134
        Returns:
3135
            The response. See :py:meth:`send_command` for details.
3136
        """
3137
        cmd = XmlCommand("get_groups")
3138
3139
        _add_filter(cmd, filter, filter_id)
3140
3141
        if trash is not None:
3142
            cmd.set_attribute("trash", _to_bool(trash))
3143
3144
        return self._send_xml_command(cmd)
3145
3146
    def get_group(self, group_id: str) -> Any:
3147
        """Request a single group