Code Duplication    Length = 29-31 lines in 12 locations

gvm/protocols/gmpv208/gmpv208.py 6 locations

@@ 5596-5626 (lines=31) @@
5593
        cmd.set_attribute("role_id", role_id)
5594
        return self._send_xml_command(cmd)
5595
5596
    def get_scanners(
5597
        self,
5598
        *,
5599
        filter: Optional[str] = None,
5600
        filter_id: Optional[str] = None,
5601
        trash: Optional[bool] = None,
5602
        details: Optional[bool] = None,
5603
    ) -> Any:
5604
        """Request a list of scanners
5605
5606
        Arguments:
5607
            filter: Filter term to use for the query
5608
            filter_id: UUID of an existing filter to use for the query
5609
            trash: Whether to get the trashcan scanners instead
5610
            details:  Whether to include extra details like tasks using this
5611
                scanner
5612
5613
        Returns:
5614
            The response. See :py:meth:`send_command` for details.
5615
        """
5616
        cmd = XmlCommand("get_scanners")
5617
5618
        _add_filter(cmd, filter, filter_id)
5619
5620
        if trash is not None:
5621
            cmd.set_attribute("trash", _to_bool(trash))
5622
5623
        if details is not None:
5624
            cmd.set_attribute("details", _to_bool(details))
5625
5626
        return self._send_xml_command(cmd)
5627
5628
    def get_scanner(self, scanner_id: str) -> Any:
5629
        """Request a single scanner
@@ 5843-5872 (lines=30) @@
5840
        cmd.set_attribute("tag_id", tag_id)
5841
        return self._send_xml_command(cmd)
5842
5843
    def get_targets(
5844
        self,
5845
        *,
5846
        filter: Optional[str] = None,
5847
        filter_id: Optional[str] = None,
5848
        trash: Optional[bool] = None,
5849
        tasks: Optional[bool] = None,
5850
    ) -> Any:
5851
        """Request a list of targets
5852
5853
        Arguments:
5854
            filter: Filter term to use for the query
5855
            filter_id: UUID of an existing filter to use for the query
5856
            trash: Whether to get the trashcan targets instead
5857
            tasks: Whether to include list of tasks that use the target
5858
5859
        Returns:
5860
            The response. See :py:meth:`send_command` for details.
5861
        """
5862
        cmd = XmlCommand("get_targets")
5863
5864
        _add_filter(cmd, filter, filter_id)
5865
5866
        if trash is not None:
5867
            cmd.set_attribute("trash", _to_bool(trash))
5868
5869
        if tasks is not None:
5870
            cmd.set_attribute("tasks", _to_bool(tasks))
5871
5872
        return self._send_xml_command(cmd)
5873
5874
    def get_target(
5875
        self, target_id: str, *, tasks: Optional[bool] = None
@@ 5793-5822 (lines=30) @@
5790
5791
        return self._send_xml_command(cmd)
5792
5793
    def get_tags(
5794
        self,
5795
        *,
5796
        filter: Optional[str] = None,
5797
        filter_id: Optional[str] = None,
5798
        trash: Optional[bool] = None,
5799
        names_only: Optional[bool] = None,
5800
    ) -> Any:
5801
        """Request a list of tags
5802
5803
        Arguments:
5804
            filter: Filter term to use for the query
5805
            filter_id: UUID of an existing filter to use for the query
5806
            trash: Whether to get tags from the trashcan instead
5807
            names_only: Whether to get only distinct tag names
5808
5809
        Returns:
5810
            The response. See :py:meth:`send_command` for details.
5811
        """
5812
        cmd = XmlCommand("get_tags")
5813
5814
        _add_filter(cmd, filter, filter_id)
5815
5816
        if trash is not None:
5817
            cmd.set_attribute("trash", _to_bool(trash))
5818
5819
        if names_only is not None:
5820
            cmd.set_attribute("names_only", _to_bool(names_only))
5821
5822
        return self._send_xml_command(cmd)
5823
5824
    def get_tag(self, tag_id: str) -> Any:
5825
        """Request a single tag
@@ 5650-5679 (lines=30) @@
5647
        cmd.set_attribute("details", "1")
5648
        return self._send_xml_command(cmd)
5649
5650
    def get_schedules(
5651
        self,
5652
        *,
5653
        filter: Optional[str] = None,
5654
        filter_id: Optional[str] = None,
5655
        trash: Optional[bool] = None,
5656
        tasks: Optional[bool] = None,
5657
    ) -> Any:
5658
        """Request a list of schedules
5659
5660
        Arguments:
5661
            filter: Filter term to use for the query
5662
            filter_id: UUID of an existing filter to use for the query
5663
            trash: Whether to get the trashcan schedules instead
5664
            tasks: Whether to include tasks using the schedules
5665
5666
        Returns:
5667
            The response. See :py:meth:`send_command` for details.
5668
        """
5669
        cmd = XmlCommand("get_schedules")
5670
5671
        _add_filter(cmd, filter, filter_id)
5672
5673
        if trash is not None:
5674
            cmd.set_attribute("trash", _to_bool(trash))
5675
5676
        if tasks is not None:
5677
            cmd.set_attribute("tasks", _to_bool(tasks))
5678
5679
        return self._send_xml_command(cmd)
5680
5681
    def get_schedule(
5682
        self, schedule_id: str, *, tasks: Optional[bool] = None
@@ 4848-4877 (lines=30) @@
4845
        """
4846
        return self._send_xml_command(XmlCommand("get_feeds"))
4847
4848
    def get_filters(
4849
        self,
4850
        *,
4851
        filter: Optional[str] = None,
4852
        filter_id: Optional[str] = None,
4853
        trash: Optional[bool] = None,
4854
        alerts: Optional[bool] = None,
4855
    ) -> Any:
4856
        """Request a list of filters
4857
4858
        Arguments:
4859
            filter: Filter term to use for the query
4860
            filter_id: UUID of an existing filter to use for the query
4861
            trash: Whether to get the trashcan filters instead
4862
            alerts: Whether to include list of alerts that use the filter.
4863
4864
        Returns:
4865
            The response. See :py:meth:`send_command` for details.
4866
        """
4867
        cmd = XmlCommand("get_filters")
4868
4869
        _add_filter(cmd, filter, filter_id)
4870
4871
        if trash is not None:
4872
            cmd.set_attribute("trash", _to_bool(trash))
4873
4874
        if alerts is not None:
4875
            cmd.set_attribute("alerts", _to_bool(alerts))
4876
4877
        return self._send_xml_command(cmd)
4878
4879
    def get_filter(
4880
        self, filter_id: str, *, alerts: Optional[bool] = None
@@ 4643-4671 (lines=29) @@
4640
4641
        return self._send_xml_command(cmd)
4642
4643
    def get_alerts(
4644
        self,
4645
        *,
4646
        filter: Optional[str] = None,
4647
        filter_id: Optional[str] = None,
4648
        trash: Optional[bool] = None,
4649
        tasks: Optional[bool] = None,
4650
    ) -> Any:
4651
        """Request a list of alerts
4652
4653
        Arguments:
4654
            filter: Filter term to use for the query
4655
            filter_id: UUID of an existing filter to use for the query
4656
            trash: True to request the alerts in the trashcan
4657
            tasks: Whether to include the tasks using the alerts
4658
        Returns:
4659
            The response. See :py:meth:`send_command` for details.
4660
        """
4661
        cmd = XmlCommand("get_alerts")
4662
4663
        _add_filter(cmd, filter, filter_id)
4664
4665
        if trash is not None:
4666
            cmd.set_attribute("trash", _to_bool(trash))
4667
4668
        if tasks is not None:
4669
            cmd.set_attribute("tasks", _to_bool(tasks))
4670
4671
        return self._send_xml_command(cmd)
4672
4673
    def get_alert(self, alert_id: str, *, tasks: Optional[bool] = None) -> Any:
4674
        """Request a single alert

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