@@ 146-181 (lines=36) @@ | ||
143 | ) |
|
144 | ) |
|
145 | ||
146 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
147 | """Request a single secinfo |
|
148 | ||
149 | Arguments: |
|
150 | info_id: UUID of an existing secinfo |
|
151 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
152 | DFN_CERT_ADV, OVALDEF, NVT |
|
153 | ||
154 | Returns: |
|
155 | The response. See :py:meth:`send_command` for details. |
|
156 | """ |
|
157 | if not info_type: |
|
158 | raise RequiredArgument( |
|
159 | function=self.get_info.__name__, argument='info_type' |
|
160 | ) |
|
161 | ||
162 | if not isinstance(info_type, InfoType): |
|
163 | raise InvalidArgumentType( |
|
164 | function=self.get_info.__name__, |
|
165 | argument='info_type', |
|
166 | arg_type=InfoType.__name__, |
|
167 | ) |
|
168 | ||
169 | if not info_id: |
|
170 | raise RequiredArgument( |
|
171 | function=self.get_info.__name__, argument='info_id' |
|
172 | ) |
|
173 | ||
174 | cmd = XmlCommand("get_info") |
|
175 | cmd.set_attribute("info_id", info_id) |
|
176 | ||
177 | cmd.set_attribute("type", info_type.value) |
|
178 | ||
179 | # for single entity always request all details |
|
180 | cmd.set_attribute("details", "1") |
|
181 | return self._send_xml_command(cmd) |
|
182 | ||
183 | def modify_schedule( |
|
184 | self, |
@@ 3203-3238 (lines=36) @@ | ||
3200 | ||
3201 | return self._send_xml_command(cmd) |
|
3202 | ||
3203 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
3204 | """Request a single secinfo |
|
3205 | ||
3206 | Arguments: |
|
3207 | info_id: UUID of an existing secinfo |
|
3208 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
3209 | DFN_CERT_ADV, OVALDEF, NVT or ALLINFO |
|
3210 | ||
3211 | Returns: |
|
3212 | The response. See :py:meth:`send_command` for details. |
|
3213 | """ |
|
3214 | cmd = XmlCommand("get_info") |
|
3215 | ||
3216 | if not info_type: |
|
3217 | raise RequiredArgument( |
|
3218 | function=self.get_info.__name__, argument='info_type' |
|
3219 | ) |
|
3220 | ||
3221 | if not isinstance(info_type, InfoType): |
|
3222 | raise InvalidArgumentType( |
|
3223 | function=self.get_info.__name__, |
|
3224 | argument='info_type', |
|
3225 | arg_type=InfoType.__name__, |
|
3226 | ) |
|
3227 | ||
3228 | if not info_id: |
|
3229 | raise RequiredArgument( |
|
3230 | function=self.get_info.__name__, argument='info_id' |
|
3231 | ) |
|
3232 | ||
3233 | cmd.set_attribute("info_id", info_id) |
|
3234 | ||
3235 | cmd.set_attribute("type", info_type.value) |
|
3236 | ||
3237 | # for single entity always request all details |
|
3238 | cmd.set_attribute("details", "1") |
|
3239 | ||
3240 | return self._send_xml_command(cmd) |
|
3241 |