@@ 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, |
@@ 4760-4787 (lines=28) @@ | ||
4757 | ||
4758 | return self._send_xml_command(cmd) |
|
4759 | ||
4760 | def get_asset(self, asset_id: str, asset_type: AssetType) -> Any: |
|
4761 | """Request a single asset |
|
4762 | ||
4763 | Arguments: |
|
4764 | asset_id: UUID of an existing asset |
|
4765 | asset_type: Either 'os' or 'host' |
|
4766 | ||
4767 | Returns: |
|
4768 | The response. See :py:meth:`send_command` for details. |
|
4769 | """ |
|
4770 | cmd = XmlCommand("get_assets") |
|
4771 | ||
4772 | if not isinstance(asset_type, AssetType): |
|
4773 | raise InvalidArgumentType( |
|
4774 | function=self.get_asset.__name__, |
|
4775 | argument='asset_type', |
|
4776 | arg_type=AssetType.__name__, |
|
4777 | ) |
|
4778 | ||
4779 | if not asset_id: |
|
4780 | raise RequiredArgument( |
|
4781 | function=self.get_asset.__name__, argument='asset_id' |
|
4782 | ) |
|
4783 | ||
4784 | cmd.set_attribute("asset_id", asset_id) |
|
4785 | cmd.set_attribute("type", asset_type.value) |
|
4786 | ||
4787 | return self._send_xml_command(cmd) |
|
4788 | ||
4789 | def get_credentials( |
|
4790 | self, |