| @@ 4728-4755 (lines=28) @@ | ||
| 4725 | ||
| 4726 | return self._send_xml_command(cmd) |
|
| 4727 | ||
| 4728 | def get_asset(self, asset_id: str, asset_type: AssetType) -> Any: |
|
| 4729 | """Request a single asset |
|
| 4730 | ||
| 4731 | Arguments: |
|
| 4732 | asset_id: UUID of an existing asset |
|
| 4733 | asset_type: Either 'os' or 'host' |
|
| 4734 | ||
| 4735 | Returns: |
|
| 4736 | The response. See :py:meth:`send_command` for details. |
|
| 4737 | """ |
|
| 4738 | cmd = XmlCommand("get_assets") |
|
| 4739 | ||
| 4740 | if not isinstance(asset_type, AssetType): |
|
| 4741 | raise InvalidArgumentType( |
|
| 4742 | function=self.get_asset.__name__, |
|
| 4743 | argument='asset_type', |
|
| 4744 | arg_type=AssetType.__name__, |
|
| 4745 | ) |
|
| 4746 | ||
| 4747 | if not asset_id: |
|
| 4748 | raise RequiredArgument( |
|
| 4749 | function=self.get_asset.__name__, argument='asset_id' |
|
| 4750 | ) |
|
| 4751 | ||
| 4752 | cmd.set_attribute("asset_id", asset_id) |
|
| 4753 | cmd.set_attribute("type", asset_type.value) |
|
| 4754 | ||
| 4755 | return self._send_xml_command(cmd) |
|
| 4756 | ||
| 4757 | def get_credentials( |
|
| 4758 | self, |
|
| @@ 2903-2930 (lines=28) @@ | ||
| 2900 | ||
| 2901 | return self._send_xml_command(cmd) |
|
| 2902 | ||
| 2903 | def get_asset(self, asset_id: str, asset_type: AssetType) -> Any: |
|
| 2904 | """Request a single asset |
|
| 2905 | ||
| 2906 | Arguments: |
|
| 2907 | asset_id: UUID of an existing asset |
|
| 2908 | asset_type: Either 'os' or 'host' |
|
| 2909 | ||
| 2910 | Returns: |
|
| 2911 | The response. See :py:meth:`send_command` for details. |
|
| 2912 | """ |
|
| 2913 | cmd = XmlCommand("get_assets") |
|
| 2914 | ||
| 2915 | if not isinstance(asset_type, AssetType): |
|
| 2916 | raise InvalidArgumentType( |
|
| 2917 | function=self.get_asset.__name__, |
|
| 2918 | argument='asset_type', |
|
| 2919 | arg_type=AssetType.__name__, |
|
| 2920 | ) |
|
| 2921 | ||
| 2922 | if not asset_id: |
|
| 2923 | raise RequiredArgument( |
|
| 2924 | function=self.get_asset.__name__, argument='asset_id' |
|
| 2925 | ) |
|
| 2926 | ||
| 2927 | cmd.set_attribute("asset_id", asset_id) |
|
| 2928 | cmd.set_attribute("type", asset_type.value) |
|
| 2929 | ||
| 2930 | return self._send_xml_command(cmd) |
|
| 2931 | ||
| 2932 | def get_credentials( |
|
| 2933 | self, |
|