共有ルールセットを使用すると、複数の異なるコンピュータ間でルールを適用および管理できます。通常、次の手順を使用して共有ルールセットを作成します。
- ルールセットの基にしたいコンピュータのために
SoftwareInventoryオブジェクトを作成および構成します。 SoftwareInventoryApiオブジェクトを使用してWorkload Securityでソフトウェアインベントリを作成します。作成されると、指定されたコンピュータでインベントリのビルドが開始されます。SoftwareInventoryApiオブジェクトを使用して、インベントリのビルドが正常に完了したことを確認します。Rulesetオブジェクトを作成します。RulesetApiオブジェクトを使用して、Workload Securityでルールセットを作成します。ComputerApiオブジェクトまたはPolicyApiオブジェクトを使用して、共有ルールセットをコンピュータに割り当てます。
共有ルールセットの詳細については、APIを使用して共有およびグローバルルールセットを作成するを参照してください。
次の例では、ソフトウェアインベントリを作成し、そのソフトウェアインベントリを使用して共有ルールセットを作成します。
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)
また、APIレファレンスの共有ルールセットの作成操作も参照してください。
