| @@ 4794-4838 (lines=45) @@ | ||
| 4791 | ||
| 4792 | return self._send_xml_command(cmd) |
|
| 4793 | ||
| 4794 | def get_credential( |
|
| 4795 | self, |
|
| 4796 | credential_id: str, |
|
| 4797 | *, |
|
| 4798 | scanners: Optional[bool] = None, |
|
| 4799 | targets: Optional[bool] = None, |
|
| 4800 | credential_format: Optional[CredentialFormat] = None, |
|
| 4801 | ) -> Any: |
|
| 4802 | """Request a single credential |
|
| 4803 | ||
| 4804 | Arguments: |
|
| 4805 | credential_id: UUID of an existing credential |
|
| 4806 | scanners: Whether to include a list of scanners using the |
|
| 4807 | credentials |
|
| 4808 | targets: Whether to include a list of targets using the credentials |
|
| 4809 | credential_format: One of "key", "rpm", "deb", "exe" or "pem" |
|
| 4810 | ||
| 4811 | Returns: |
|
| 4812 | The response. See :py:meth:`send_command` for details. |
|
| 4813 | """ |
|
| 4814 | if not credential_id: |
|
| 4815 | raise RequiredArgument( |
|
| 4816 | function=self.get_credential.__name__, argument='credential_id' |
|
| 4817 | ) |
|
| 4818 | ||
| 4819 | cmd = XmlCommand("get_credentials") |
|
| 4820 | cmd.set_attribute("credential_id", credential_id) |
|
| 4821 | ||
| 4822 | if credential_format: |
|
| 4823 | if not isinstance(credential_format, CredentialFormat): |
|
| 4824 | raise InvalidArgumentType( |
|
| 4825 | function=self.get_credential.__name__, |
|
| 4826 | argument='credential_format', |
|
| 4827 | arg_type=CredentialFormat.__name__, |
|
| 4828 | ) |
|
| 4829 | ||
| 4830 | cmd.set_attribute("format", credential_format.value) |
|
| 4831 | ||
| 4832 | if scanners is not None: |
|
| 4833 | cmd.set_attribute("scanners", _to_bool(scanners)) |
|
| 4834 | ||
| 4835 | if targets is not None: |
|
| 4836 | cmd.set_attribute("targets", _to_bool(targets)) |
|
| 4837 | ||
| 4838 | return self._send_xml_command(cmd) |
|
| 4839 | ||
| 4840 | def get_feeds(self) -> Any: |
|
| 4841 | """Request the list of feeds |
|
| @@ 2969-3013 (lines=45) @@ | ||
| 2966 | ||
| 2967 | return self._send_xml_command(cmd) |
|
| 2968 | ||
| 2969 | def get_credential( |
|
| 2970 | self, |
|
| 2971 | credential_id: str, |
|
| 2972 | *, |
|
| 2973 | scanners: Optional[bool] = None, |
|
| 2974 | targets: Optional[bool] = None, |
|
| 2975 | credential_format: Optional[CredentialFormat] = None, |
|
| 2976 | ) -> Any: |
|
| 2977 | """Request a single credential |
|
| 2978 | ||
| 2979 | Arguments: |
|
| 2980 | credential_id: UUID of an existing credential |
|
| 2981 | scanners: Whether to include a list of scanners using the |
|
| 2982 | credentials |
|
| 2983 | targets: Whether to include a list of targets using the credentials |
|
| 2984 | credential_format: One of "key", "rpm", "deb", "exe" or "pem" |
|
| 2985 | ||
| 2986 | Returns: |
|
| 2987 | The response. See :py:meth:`send_command` for details. |
|
| 2988 | """ |
|
| 2989 | if not credential_id: |
|
| 2990 | raise RequiredArgument( |
|
| 2991 | function=self.get_credential.__name__, argument='credential_id' |
|
| 2992 | ) |
|
| 2993 | ||
| 2994 | cmd = XmlCommand("get_credentials") |
|
| 2995 | cmd.set_attribute("credential_id", credential_id) |
|
| 2996 | ||
| 2997 | if credential_format: |
|
| 2998 | if not isinstance(credential_format, CredentialFormat): |
|
| 2999 | raise InvalidArgumentType( |
|
| 3000 | function=self.get_credential.__name__, |
|
| 3001 | argument='credential_format', |
|
| 3002 | arg_type=CredentialFormat.__name__, |
|
| 3003 | ) |
|
| 3004 | ||
| 3005 | cmd.set_attribute("format", credential_format.value) |
|
| 3006 | ||
| 3007 | if scanners is not None: |
|
| 3008 | cmd.set_attribute("scanners", _to_bool(scanners)) |
|
| 3009 | ||
| 3010 | if targets is not None: |
|
| 3011 | cmd.set_attribute("targets", _to_bool(targets)) |
|
| 3012 | ||
| 3013 | return self._send_xml_command(cmd) |
|
| 3014 | ||
| 3015 | def get_configs( |
|
| 3016 | self, |
|