|
1 |
| -# SPDX-FileCopyrightText: 2024 Greenbone AG |
| 1 | +# SPDX-FileCopyrightText: 2025 Greenbone AG |
2 | 2 | #
|
3 | 3 | # SPDX-License-Identifier: GPL-3.0-or-later
|
4 | 4 |
|
5 | 5 | """
|
6 | 6 | Greenbone Management Protocol (GMP) version 22.6
|
7 | 7 | """
|
8 | 8 |
|
9 |
| -from typing import Optional, Union |
| 9 | +from typing import Optional, Sequence, Union |
10 | 10 |
|
11 | 11 | from .._protocol import T
|
12 | 12 | from ._gmp225 import GMPv225
|
|
15 | 15 | EntityID,
|
16 | 16 | Filters,
|
17 | 17 | FilterType,
|
| 18 | + ReportConfigParameter, |
| 19 | + ReportConfigs, |
18 | 20 | ReportFormatType,
|
19 | 21 | Reports,
|
20 | 22 | ResourceNames,
|
@@ -334,3 +336,113 @@ def modify_filter(
|
334 | 336 | filter_type=filter_type,
|
335 | 337 | )
|
336 | 338 | )
|
| 339 | + |
| 340 | + def clone_report_config(self, report_config_id: EntityID) -> T: |
| 341 | + """Clone a report config from an existing one |
| 342 | +
|
| 343 | + Args: |
| 344 | + report_config_id: UUID of the existing report config |
| 345 | + """ |
| 346 | + return self._send_and_transform_command( |
| 347 | + ReportConfigs.clone_report_config(report_config_id) |
| 348 | + ) |
| 349 | + |
| 350 | + def delete_report_config( |
| 351 | + self, |
| 352 | + report_config_id: EntityID, |
| 353 | + *, |
| 354 | + ultimate: Optional[bool] = False, |
| 355 | + ) -> T: |
| 356 | + """Deletes an existing report config |
| 357 | +
|
| 358 | + Args: |
| 359 | + report_config_id: UUID of the report config to be deleted. |
| 360 | + ultimate: Whether to remove entirely, or to the trashcan. |
| 361 | + """ |
| 362 | + return self._send_and_transform_command( |
| 363 | + ReportConfigs.delete_report_config( |
| 364 | + report_config_id, ultimate=ultimate |
| 365 | + ) |
| 366 | + ) |
| 367 | + |
| 368 | + def get_report_configs( |
| 369 | + self, |
| 370 | + *, |
| 371 | + filter_string: Optional[str] = None, |
| 372 | + filter_id: Optional[EntityID] = None, |
| 373 | + trash: Optional[bool] = None, |
| 374 | + details: Optional[bool] = None, |
| 375 | + ) -> T: |
| 376 | + """Request a list of report configs |
| 377 | +
|
| 378 | + Args: |
| 379 | + filter_string: Filter term to use for the query |
| 380 | + filter_id: UUID of an existing filter to use for the query |
| 381 | + trash: Whether to get the trashcan report configs instead |
| 382 | + details: Include report config details |
| 383 | + """ |
| 384 | + return self._send_and_transform_command( |
| 385 | + ReportConfigs.get_report_configs( |
| 386 | + filter_string=filter_string, |
| 387 | + filter_id=filter_id, |
| 388 | + trash=trash, |
| 389 | + details=details, |
| 390 | + ) |
| 391 | + ) |
| 392 | + |
| 393 | + def get_report_config( |
| 394 | + self, |
| 395 | + report_config_id: EntityID, |
| 396 | + ) -> T: |
| 397 | + """Request a single report config |
| 398 | +
|
| 399 | + Args: |
| 400 | + report_config_id: UUID of an existing report config |
| 401 | + """ |
| 402 | + return self._send_and_transform_command( |
| 403 | + ReportConfigs.get_report_config(report_config_id) |
| 404 | + ) |
| 405 | + |
| 406 | + def create_report_config( |
| 407 | + self, |
| 408 | + name: str, |
| 409 | + report_format_id: Union[EntityID, ReportFormatType], |
| 410 | + *, |
| 411 | + comment: Optional[str] = None, |
| 412 | + params: Optional[Sequence[ReportConfigParameter]] = None, |
| 413 | + ) -> T: |
| 414 | + """Create a report config |
| 415 | +
|
| 416 | + Args: |
| 417 | + name: Name of the new report config |
| 418 | + report_format_id: UUID of the report format to be used or ReportFormatType. |
| 419 | + comment: An optional comment for the report config. |
| 420 | + params: A list of report config parameters. |
| 421 | + """ |
| 422 | + return self._send_and_transform_command( |
| 423 | + ReportConfigs.create_report_config( |
| 424 | + name, report_format_id, comment=comment, params=params |
| 425 | + ) |
| 426 | + ) |
| 427 | + |
| 428 | + def modify_report_config( |
| 429 | + self, |
| 430 | + report_config_id: EntityID, |
| 431 | + *, |
| 432 | + name: Optional[str] = None, |
| 433 | + comment: Optional[str] = None, |
| 434 | + params: Optional[Sequence[ReportConfigParameter]] = None, |
| 435 | + ) -> T: |
| 436 | + """Create a report config |
| 437 | +
|
| 438 | + Args: |
| 439 | + name: Name of the report config |
| 440 | + report_config_id: UUID of the report config to be modified. |
| 441 | + comment: An optional comment for the report config. |
| 442 | + params: A list of report config parameters. |
| 443 | + """ |
| 444 | + return self._send_and_transform_command( |
| 445 | + ReportConfigs.modify_report_config( |
| 446 | + report_config_id, name=name, comment=comment, params=params |
| 447 | + ) |
| 448 | + ) |
0 commit comments