Topics on this page
Create a shared ruleset
Shared rulesets allow you to apply and manage your rules across multiple different computers. Generally, use the following steps to create a shared ruleset:
- Create and configure a
SoftwareInventoryobject for the computer you wish to base the ruleset on.
- Use a
SoftwareInventoryApiobject to create the software inventory on Workload Security. Once it's created, an inventory build begins on the specified computer.
- Use the
SoftwareInventoryApiobject to confirm that the inventory build has completed successfully.
- Create a
- Use a
RulesetApiobject to create the Ruleset on Workload Security.
- Use a
ComputerApiobject or a
PolicyApiobject to assign the shared ruleset to your computer(s).
For more information about shared rulesets, see the Use the API to create shared and global rulesets.
The following example creates a software inventory and uses that software inventory to create a Shared Ruleset.
software_inventory = api.SoftwareInventory() software_inventory.computer_id = computer_id # Build software_inventory software_inventories_api = api.SoftwareInventoriesApi(api.ApiClient(configuration)) new_inventory = software_inventories_api.create_software_inventory(software_inventory, api_version) while new_inventory.state != "complete": # check status every 30 seconds time.sleep(30) new_inventory = software_inventories_api.describe_software_inventory(new_inventory.id, api_version) # Create ruleset ruleset = api.Ruleset() ruleset.name = ruleset_name rulesets_api = api.RulesetsApi(api.ApiClient(configuration)) return rulesets_api.create_ruleset(ruleset, new_inventory.id, api_version)
Also see the Create a Shared Ruleset operation in the API Reference.