Code Duplication    Length = 29-31 lines in 12 locations

gvm/protocols/gmpv7/gmpv7.py 6 locations

@@ 3962-3992 (lines=31) @@
3959
        cmd.set_attribute("role_id", role_id)
3960
        return self._send_xml_command(cmd)
3961
3962
    def get_scanners(
3963
        self,
3964
        *,
3965
        filter: Optional[str] = None,
3966
        filter_id: Optional[str] = None,
3967
        trash: Optional[bool] = None,
3968
        details: Optional[bool] = None,
3969
    ) -> Any:
3970
        """Request a list of scanners
3971
3972
        Arguments:
3973
            filter: Filter term to use for the query
3974
            filter_id: UUID of an existing filter to use for the query
3975
            trash: Whether to get the trashcan scanners instead
3976
            details:  Whether to include extra details like tasks using this
3977
                scanner
3978
3979
        Returns:
3980
            The response. See :py:meth:`send_command` for details.
3981
        """
3982
        cmd = XmlCommand("get_scanners")
3983
3984
        _add_filter(cmd, filter, filter_id)
3985
3986
        if trash is not None:
3987
            cmd.set_attribute("trash", _to_bool(trash))
3988
3989
        if details is not None:
3990
            cmd.set_attribute("details", _to_bool(details))
3991
3992
        return self._send_xml_command(cmd)
3993
3994
    def get_scanner(self, scanner_id: str) -> Any:
3995
        """Request a single scanner
@@ 4209-4238 (lines=30) @@
4206
        cmd.set_attribute("tag_id", tag_id)
4207
        return self._send_xml_command(cmd)
4208
4209
    def get_targets(
4210
        self,
4211
        *,
4212
        filter: Optional[str] = None,
4213
        filter_id: Optional[str] = None,
4214
        trash: Optional[bool] = None,
4215
        tasks: Optional[bool] = None,
4216
    ) -> Any:
4217
        """Request a list of targets
4218
4219
        Arguments:
4220
            filter: Filter term to use for the query
4221
            filter_id: UUID of an existing filter to use for the query
4222
            trash: Whether to get the trashcan targets instead
4223
            tasks: Whether to include list of tasks that use the target
4224
4225
        Returns:
4226
            The response. See :py:meth:`send_command` for details.
4227
        """
4228
        cmd = XmlCommand("get_targets")
4229
4230
        _add_filter(cmd, filter, filter_id)
4231
4232
        if trash is not None:
4233
            cmd.set_attribute("trash", _to_bool(trash))
4234
4235
        if tasks is not None:
4236
            cmd.set_attribute("tasks", _to_bool(tasks))
4237
4238
        return self._send_xml_command(cmd)
4239
4240
    def get_target(
4241
        self, target_id: str, *, tasks: Optional[bool] = None
@@ 4159-4188 (lines=30) @@
4156
4157
        return self._send_xml_command(cmd)
4158
4159
    def get_tags(
4160
        self,
4161
        *,
4162
        filter: Optional[str] = None,
4163
        filter_id: Optional[str] = None,
4164
        trash: Optional[bool] = None,
4165
        names_only: Optional[bool] = None,
4166
    ) -> Any:
4167
        """Request a list of tags
4168
4169
        Arguments:
4170
            filter: Filter term to use for the query
4171
            filter_id: UUID of an existing filter to use for the query
4172
            trash: Whether to get tags from the trashcan instead
4173
            names_only: Whether to get only distinct tag names
4174
4175
        Returns:
4176
            The response. See :py:meth:`send_command` for details.
4177
        """
4178
        cmd = XmlCommand("get_tags")
4179
4180
        _add_filter(cmd, filter, filter_id)
4181
4182
        if trash is not None:
4183
            cmd.set_attribute("trash", _to_bool(trash))
4184
4185
        if names_only is not None:
4186
            cmd.set_attribute("names_only", _to_bool(names_only))
4187
4188
        return self._send_xml_command(cmd)
4189
4190
    def get_tag(self, tag_id: str) -> Any:
4191
        """Request a single tag
@@ 4016-4045 (lines=30) @@
4013
        cmd.set_attribute("details", "1")
4014
        return self._send_xml_command(cmd)
4015
4016
    def get_schedules(
4017
        self,
4018
        *,
4019
        filter: Optional[str] = None,
4020
        filter_id: Optional[str] = None,
4021
        trash: Optional[bool] = None,
4022
        tasks: Optional[bool] = None,
4023
    ) -> Any:
4024
        """Request a list of schedules
4025
4026
        Arguments:
4027
            filter: Filter term to use for the query
4028
            filter_id: UUID of an existing filter to use for the query
4029
            trash: Whether to get the trashcan schedules instead
4030
            tasks: Whether to include tasks using the schedules
4031
4032
        Returns:
4033
            The response. See :py:meth:`send_command` for details.
4034
        """
4035
        cmd = XmlCommand("get_schedules")
4036
4037
        _add_filter(cmd, filter, filter_id)
4038
4039
        if trash is not None:
4040
            cmd.set_attribute("trash", _to_bool(trash))
4041
4042
        if tasks is not None:
4043
            cmd.set_attribute("tasks", _to_bool(tasks))
4044
4045
        return self._send_xml_command(cmd)
4046
4047
    def get_schedule(
4048
        self, schedule_id: str, *, tasks: Optional[bool] = None
@@ 3126-3155 (lines=30) @@
3123
3124
        return self._send_xml_command(cmd)
3125
3126
    def get_filters(
3127
        self,
3128
        *,
3129
        filter: Optional[str] = None,
3130
        filter_id: Optional[str] = None,
3131
        trash: Optional[bool] = None,
3132
        alerts: Optional[bool] = None,
3133
    ) -> Any:
3134
        """Request a list of filters
3135
3136
        Arguments:
3137
            filter: Filter term to use for the query
3138
            filter_id: UUID of an existing filter to use for the query
3139
            trash: Whether to get the trashcan filters instead
3140
            alerts: Whether to include list of alerts that use the filter.
3141
3142
        Returns:
3143
            The response. See :py:meth:`send_command` for details.
3144
        """
3145
        cmd = XmlCommand("get_filters")
3146
3147
        _add_filter(cmd, filter, filter_id)
3148
3149
        if trash is not None:
3150
            cmd.set_attribute("trash", _to_bool(trash))
3151
3152
        if alerts is not None:
3153
            cmd.set_attribute("alerts", _to_bool(alerts))
3154
3155
        return self._send_xml_command(cmd)
3156
3157
    def get_filter(
3158
        self, filter_id: str, *, alerts: Optional[bool] = None
@@ 2818-2846 (lines=29) @@
2815
        cmd.set_attributes(kwargs)
2816
        return self._send_xml_command(cmd)
2817
2818
    def get_alerts(
2819
        self,
2820
        *,
2821
        filter: Optional[str] = None,
2822
        filter_id: Optional[str] = None,
2823
        trash: Optional[bool] = None,
2824
        tasks: Optional[bool] = None,
2825
    ) -> Any:
2826
        """Request a list of alerts
2827
2828
        Arguments:
2829
            filter: Filter term to use for the query
2830
            filter_id: UUID of an existing filter to use for the query
2831
            trash: True to request the alerts in the trashcan
2832
            tasks: Whether to include the tasks using the alerts
2833
        Returns:
2834
            The response. See :py:meth:`send_command` for details.
2835
        """
2836
        cmd = XmlCommand("get_alerts")
2837
2838
        _add_filter(cmd, filter, filter_id)
2839
2840
        if trash is not None:
2841
            cmd.set_attribute("trash", _to_bool(trash))
2842
2843
        if tasks is not None:
2844
            cmd.set_attribute("tasks", _to_bool(tasks))
2845
2846
        return self._send_xml_command(cmd)
2847
2848
    def get_alert(self, alert_id: str, *, tasks: Optional[bool] = None) -> Any:
2849
        """Request a single alert

gvm/protocols/gmpv208/gmpv208.py 6 locations

@@ 5628-5658 (lines=31) @@
5625
        cmd.set_attribute("role_id", role_id)
5626
        return self._send_xml_command(cmd)
5627
5628
    def get_scanners(
5629
        self,
5630
        *,
5631
        filter: Optional[str] = None,
5632
        filter_id: Optional[str] = None,
5633
        trash: Optional[bool] = None,
5634
        details: Optional[bool] = None,
5635
    ) -> Any:
5636
        """Request a list of scanners
5637
5638
        Arguments:
5639
            filter: Filter term to use for the query
5640
            filter_id: UUID of an existing filter to use for the query
5641
            trash: Whether to get the trashcan scanners instead
5642
            details:  Whether to include extra details like tasks using this
5643
                scanner
5644
5645
        Returns:
5646
            The response. See :py:meth:`send_command` for details.
5647
        """
5648
        cmd = XmlCommand("get_scanners")
5649
5650
        _add_filter(cmd, filter, filter_id)
5651
5652
        if trash is not None:
5653
            cmd.set_attribute("trash", _to_bool(trash))
5654
5655
        if details is not None:
5656
            cmd.set_attribute("details", _to_bool(details))
5657
5658
        return self._send_xml_command(cmd)
5659
5660
    def get_scanner(self, scanner_id: str) -> Any:
5661
        """Request a single scanner
@@ 5875-5904 (lines=30) @@
5872
        cmd.set_attribute("tag_id", tag_id)
5873
        return self._send_xml_command(cmd)
5874
5875
    def get_targets(
5876
        self,
5877
        *,
5878
        filter: Optional[str] = None,
5879
        filter_id: Optional[str] = None,
5880
        trash: Optional[bool] = None,
5881
        tasks: Optional[bool] = None,
5882
    ) -> Any:
5883
        """Request a list of targets
5884
5885
        Arguments:
5886
            filter: Filter term to use for the query
5887
            filter_id: UUID of an existing filter to use for the query
5888
            trash: Whether to get the trashcan targets instead
5889
            tasks: Whether to include list of tasks that use the target
5890
5891
        Returns:
5892
            The response. See :py:meth:`send_command` for details.
5893
        """
5894
        cmd = XmlCommand("get_targets")
5895
5896
        _add_filter(cmd, filter, filter_id)
5897
5898
        if trash is not None:
5899
            cmd.set_attribute("trash", _to_bool(trash))
5900
5901
        if tasks is not None:
5902
            cmd.set_attribute("tasks", _to_bool(tasks))
5903
5904
        return self._send_xml_command(cmd)
5905
5906
    def get_target(
5907
        self, target_id: str, *, tasks: Optional[bool] = None
@@ 5825-5854 (lines=30) @@
5822
5823
        return self._send_xml_command(cmd)
5824
5825
    def get_tags(
5826
        self,
5827
        *,
5828
        filter: Optional[str] = None,
5829
        filter_id: Optional[str] = None,
5830
        trash: Optional[bool] = None,
5831
        names_only: Optional[bool] = None,
5832
    ) -> Any:
5833
        """Request a list of tags
5834
5835
        Arguments:
5836
            filter: Filter term to use for the query
5837
            filter_id: UUID of an existing filter to use for the query
5838
            trash: Whether to get tags from the trashcan instead
5839
            names_only: Whether to get only distinct tag names
5840
5841
        Returns:
5842
            The response. See :py:meth:`send_command` for details.
5843
        """
5844
        cmd = XmlCommand("get_tags")
5845
5846
        _add_filter(cmd, filter, filter_id)
5847
5848
        if trash is not None:
5849
            cmd.set_attribute("trash", _to_bool(trash))
5850
5851
        if names_only is not None:
5852
            cmd.set_attribute("names_only", _to_bool(names_only))
5853
5854
        return self._send_xml_command(cmd)
5855
5856
    def get_tag(self, tag_id: str) -> Any:
5857
        """Request a single tag
@@ 5682-5711 (lines=30) @@
5679
        cmd.set_attribute("details", "1")
5680
        return self._send_xml_command(cmd)
5681
5682
    def get_schedules(
5683
        self,
5684
        *,
5685
        filter: Optional[str] = None,
5686
        filter_id: Optional[str] = None,
5687
        trash: Optional[bool] = None,
5688
        tasks: Optional[bool] = None,
5689
    ) -> Any:
5690
        """Request a list of schedules
5691
5692
        Arguments:
5693
            filter: Filter term to use for the query
5694
            filter_id: UUID of an existing filter to use for the query
5695
            trash: Whether to get the trashcan schedules instead
5696
            tasks: Whether to include tasks using the schedules
5697
5698
        Returns:
5699
            The response. See :py:meth:`send_command` for details.
5700
        """
5701
        cmd = XmlCommand("get_schedules")
5702
5703
        _add_filter(cmd, filter, filter_id)
5704
5705
        if trash is not None:
5706
            cmd.set_attribute("trash", _to_bool(trash))
5707
5708
        if tasks is not None:
5709
            cmd.set_attribute("tasks", _to_bool(tasks))
5710
5711
        return self._send_xml_command(cmd)
5712
5713
    def get_schedule(
5714
        self, schedule_id: str, *, tasks: Optional[bool] = None
@@ 4880-4909 (lines=30) @@
4877
        """
4878
        return self._send_xml_command(XmlCommand("get_feeds"))
4879
4880
    def get_filters(
4881
        self,
4882
        *,
4883
        filter: Optional[str] = None,
4884
        filter_id: Optional[str] = None,
4885
        trash: Optional[bool] = None,
4886
        alerts: Optional[bool] = None,
4887
    ) -> Any:
4888
        """Request a list of filters
4889
4890
        Arguments:
4891
            filter: Filter term to use for the query
4892
            filter_id: UUID of an existing filter to use for the query
4893
            trash: Whether to get the trashcan filters instead
4894
            alerts: Whether to include list of alerts that use the filter.
4895
4896
        Returns:
4897
            The response. See :py:meth:`send_command` for details.
4898
        """
4899
        cmd = XmlCommand("get_filters")
4900
4901
        _add_filter(cmd, filter, filter_id)
4902
4903
        if trash is not None:
4904
            cmd.set_attribute("trash", _to_bool(trash))
4905
4906
        if alerts is not None:
4907
            cmd.set_attribute("alerts", _to_bool(alerts))
4908
4909
        return self._send_xml_command(cmd)
4910
4911
    def get_filter(
4912
        self, filter_id: str, *, alerts: Optional[bool] = None
@@ 4675-4703 (lines=29) @@
4672
4673
        return self._send_xml_command(cmd)
4674
4675
    def get_alerts(
4676
        self,
4677
        *,
4678
        filter: Optional[str] = None,
4679
        filter_id: Optional[str] = None,
4680
        trash: Optional[bool] = None,
4681
        tasks: Optional[bool] = None,
4682
    ) -> Any:
4683
        """Request a list of alerts
4684
4685
        Arguments:
4686
            filter: Filter term to use for the query
4687
            filter_id: UUID of an existing filter to use for the query
4688
            trash: True to request the alerts in the trashcan
4689
            tasks: Whether to include the tasks using the alerts
4690
        Returns:
4691
            The response. See :py:meth:`send_command` for details.
4692
        """
4693
        cmd = XmlCommand("get_alerts")
4694
4695
        _add_filter(cmd, filter, filter_id)
4696
4697
        if trash is not None:
4698
            cmd.set_attribute("trash", _to_bool(trash))
4699
4700
        if tasks is not None:
4701
            cmd.set_attribute("tasks", _to_bool(tasks))
4702
4703
        return self._send_xml_command(cmd)
4704
4705
    def get_alert(self, alert_id: str, *, tasks: Optional[bool] = None) -> Any:
4706
        """Request a single alert