Code Duplication    Length = 49-49 lines in 2 locations

gvm/protocols/gmpv208/entities/scan_configs.py 1 location

@@ 137-185 (lines=49) @@
134
135
        return self._send_xml_command(cmd)
136
137
    def get_scan_configs(
138
        self,
139
        *,
140
        filter: Optional[str] = None,
141
        filter_id: Optional[str] = None,
142
        trash: Optional[bool] = None,
143
        details: Optional[bool] = None,
144
        families: Optional[bool] = None,
145
        preferences: Optional[bool] = None,
146
        tasks: Optional[bool] = None,
147
    ) -> Any:
148
        """Request a list of scan configs
149
150
        Arguments:
151
            filter: Filter term to use for the query
152
            filter_id: UUID of an existing filter to use for the query
153
            trash: Whether to get the trashcan scan configs instead
154
            details: Whether to get config families, preferences, nvt selectors
155
                and tasks.
156
            families: Whether to include the families if no details are
157
                requested
158
            preferences: Whether to include the preferences if no details are
159
                requested
160
            tasks: Whether to get tasks using this config
161
162
        Returns:
163
            The response. See :py:meth:`send_command` for details.
164
        """
165
        cmd = XmlCommand("get_configs")
166
        cmd.set_attribute("usage_type", "scan")
167
168
        add_filter(cmd, filter, filter_id)
169
170
        if trash is not None:
171
            cmd.set_attribute("trash", to_bool(trash))
172
173
        if details is not None:
174
            cmd.set_attribute("details", to_bool(details))
175
176
        if families is not None:
177
            cmd.set_attribute("families", to_bool(families))
178
179
        if preferences is not None:
180
            cmd.set_attribute("preferences", to_bool(preferences))
181
182
        if tasks is not None:
183
            cmd.set_attribute("tasks", to_bool(tasks))
184
185
        return self._send_xml_command(cmd)
186
187
    def get_scan_config(
188
        self, config_id: str, *, tasks: Optional[bool] = None

gvm/protocols/gmpv208/entities/policies.py 1 location

@@ 100-148 (lines=49) @@
97
98
        return self._send_xml_command(cmd)
99
100
    def get_policies(
101
        self,
102
        *,
103
        audits: Optional[bool] = None,
104
        filter: Optional[str] = None,
105
        filter_id: Optional[str] = None,
106
        details: Optional[bool] = None,
107
        families: Optional[bool] = None,
108
        preferences: Optional[bool] = None,
109
        trash: Optional[bool] = None,
110
    ) -> Any:
111
        """Request a list of policies
112
113
        Arguments:
114
            audits: Whether to get audits using the policy
115
            filter: Filter term to use for the query
116
            filter_id: UUID of an existing filter to use for the query
117
            details: Whether to get  families, preferences, nvt selectors
118
                and tasks.
119
            families: Whether to include the families if no details are
120
                requested
121
            preferences: Whether to include the preferences if no details are
122
                requested
123
            trash: Whether to get the trashcan audits instead
124
125
        Returns:
126
            The response. See :py:meth:`send_command` for details.
127
        """
128
        cmd = XmlCommand("get_configs")
129
        cmd.set_attribute("usage_type", "policy")
130
131
        add_filter(cmd, filter, filter_id)
132
133
        if trash is not None:
134
            cmd.set_attribute("trash", to_bool(trash))
135
136
        if details is not None:
137
            cmd.set_attribute("details", to_bool(details))
138
139
        if families is not None:
140
            cmd.set_attribute("families", to_bool(families))
141
142
        if preferences is not None:
143
            cmd.set_attribute("preferences", to_bool(preferences))
144
145
        if audits is not None:
146
            cmd.set_attribute("tasks", to_bool(audits))
147
148
        return self._send_xml_command(cmd)
149
150
    def get_policy(
151
        self, policy_id: str, *, audits: Optional[bool] = None