| @@ 133-181 (lines=49) @@ | ||
| 130 | ||
| 131 | return self._send_xml_command(cmd) |
|
| 132 | ||
| 133 | def get_scan_configs( |
|
| 134 | self, |
|
| 135 | *, |
|
| 136 | filter_string: Optional[str] = None, |
|
| 137 | filter_id: Optional[str] = None, |
|
| 138 | trash: Optional[bool] = None, |
|
| 139 | details: Optional[bool] = None, |
|
| 140 | families: Optional[bool] = None, |
|
| 141 | preferences: Optional[bool] = None, |
|
| 142 | tasks: Optional[bool] = None, |
|
| 143 | ) -> Any: |
|
| 144 | """Request a list of scan configs |
|
| 145 | ||
| 146 | Arguments: |
|
| 147 | filter_string: Filter term to use for the query |
|
| 148 | filter_id: UUID of an existing filter to use for the query |
|
| 149 | trash: Whether to get the trashcan scan configs instead |
|
| 150 | details: Whether to get config families, preferences, nvt selectors |
|
| 151 | and tasks. |
|
| 152 | families: Whether to include the families if no details are |
|
| 153 | requested |
|
| 154 | preferences: Whether to include the preferences if no details are |
|
| 155 | requested |
|
| 156 | tasks: Whether to get tasks using this config |
|
| 157 | ||
| 158 | Returns: |
|
| 159 | The response. See :py:meth:`send_command` for details. |
|
| 160 | """ |
|
| 161 | cmd = XmlCommand("get_configs") |
|
| 162 | cmd.set_attribute("usage_type", "scan") |
|
| 163 | ||
| 164 | add_filter(cmd, filter_string, filter_id) |
|
| 165 | ||
| 166 | if trash is not None: |
|
| 167 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 168 | ||
| 169 | if details is not None: |
|
| 170 | cmd.set_attribute("details", to_bool(details)) |
|
| 171 | ||
| 172 | if families is not None: |
|
| 173 | cmd.set_attribute("families", to_bool(families)) |
|
| 174 | ||
| 175 | if preferences is not None: |
|
| 176 | cmd.set_attribute("preferences", to_bool(preferences)) |
|
| 177 | ||
| 178 | if tasks is not None: |
|
| 179 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 180 | ||
| 181 | return self._send_xml_command(cmd) |
|
| 182 | ||
| 183 | def get_scan_config( |
|
| 184 | self, config_id: str, *, tasks: Optional[bool] = None |
|
| @@ 96-144 (lines=49) @@ | ||
| 93 | ||
| 94 | return self._send_xml_command(cmd) |
|
| 95 | ||
| 96 | def get_policies( |
|
| 97 | self, |
|
| 98 | *, |
|
| 99 | audits: Optional[bool] = None, |
|
| 100 | filter_string: Optional[str] = None, |
|
| 101 | filter_id: Optional[str] = None, |
|
| 102 | details: Optional[bool] = None, |
|
| 103 | families: Optional[bool] = None, |
|
| 104 | preferences: Optional[bool] = None, |
|
| 105 | trash: Optional[bool] = None, |
|
| 106 | ) -> Any: |
|
| 107 | """Request a list of policies |
|
| 108 | ||
| 109 | Arguments: |
|
| 110 | audits: Whether to get audits using the policy |
|
| 111 | filter_string: Filter term to use for the query |
|
| 112 | filter_id: UUID of an existing filter to use for the query |
|
| 113 | details: Whether to get families, preferences, nvt selectors |
|
| 114 | and tasks. |
|
| 115 | families: Whether to include the families if no details are |
|
| 116 | requested |
|
| 117 | preferences: Whether to include the preferences if no details are |
|
| 118 | requested |
|
| 119 | trash: Whether to get the trashcan audits instead |
|
| 120 | ||
| 121 | Returns: |
|
| 122 | The response. See :py:meth:`send_command` for details. |
|
| 123 | """ |
|
| 124 | cmd = XmlCommand("get_configs") |
|
| 125 | cmd.set_attribute("usage_type", "policy") |
|
| 126 | ||
| 127 | add_filter(cmd, filter_string, filter_id) |
|
| 128 | ||
| 129 | if trash is not None: |
|
| 130 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 131 | ||
| 132 | if details is not None: |
|
| 133 | cmd.set_attribute("details", to_bool(details)) |
|
| 134 | ||
| 135 | if families is not None: |
|
| 136 | cmd.set_attribute("families", to_bool(families)) |
|
| 137 | ||
| 138 | if preferences is not None: |
|
| 139 | cmd.set_attribute("preferences", to_bool(preferences)) |
|
| 140 | ||
| 141 | if audits is not None: |
|
| 142 | cmd.set_attribute("tasks", to_bool(audits)) |
|
| 143 | ||
| 144 | return self._send_xml_command(cmd) |
|
| 145 | ||
| 146 | def get_policy( |
|
| 147 | self, policy_id: str, *, audits: Optional[bool] = None |
|